# Path: resources/lib/modules/control.py
# SORT_METHOD_NONE = xbmcplugin.SORT_METHOD_NONE
# SORT_METHOD_UNSORTED = xbmcplugin.SORT_METHOD_UNSORTED
# SORT_METHOD_VIDEO_RATING = xbmcplugin.SORT_METHOD_VIDEO_RATING
# SORT_METHOD_TRACKNUM = xbmcplugin.SORT_METHOD_TRACKNUM
# SORT_METHOD_FILE = xbmcplugin.SORT_METHOD_FILE
# SORT_METHOD_TITLE = xbmcplugin.SORT_METHOD_TITLE
# SORT_METHOD_TITLE_IGNORE_THE = xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE
# SORT_METHOD_VIDEO_TITLE = xbmcplugin.SORT_METHOD_VIDEO_TITLE
# SORT_METHOD_VIDEO_SORT_TITLE = xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE
# SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE = xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE
# SORT_METHOD_VIDEO_RUNTIME = xbmcplugin.SORT_METHOD_VIDEO_RUNTIME
# SORT_METHOD_FULLPATH = xbmcplugin.SORT_METHOD_FULLPATH
# SORT_METHOD_LABEL = xbmcplugin.SORT_METHOD_LABEL
# SORT_METHOD_LABEL_IGNORE_THE = xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE
# SORT_METHOD_LABEL_IGNORE_FOLDERS = xbmcplugin.SORT_METHOD_LABEL_IGNORE_FOLDERS
# SORT_METHOD_CHANNEL = xbmcplugin.SORT_METHOD_CHANNEL
# SORT_METHOD_DATE = xbmcplugin.SORT_METHOD_DATE
# SORT_METHOD_DATEADDED = xbmcplugin.SORT_METHOD_DATEADDED
# SORT_METHOD_PLAYLIST_ORDER = xbmcplugin.SORT_METHOD_PLAYLIST_ORDER
# SORT_METHOD_EPISODE = xbmcplugin.SORT_METHOD_EPISODE
# SORT_METHOD_STUDIO = xbmcplugin.SORT_METHOD_STUDIO
# SORT_METHOD_STUDIO_IGNORE_THE = xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE
# SORT_METHOD_MPAA_RATING = xbmcplugin.SORT_METHOD_MPAA_RATING
# LOGDEBUG = 0
# LOGERROR = 4
# LOGFATAL = 6
# LOGINFO = 1
# LOGNONE = 7
# LOGNOTICE = 2
# LOGSEVERE = 5
# LOGWARNING = 3
# INFO_LABELS = [
#     'genre',
#     'country',
#     'year',
#     'episode',
#     'season',
#     'sortepisode',
#     'sortseason',
#     'episodeguide',
#     'showlink',
#     'top250',
#     'setid',
#     'tracknumber',
#     'rating',
#     'userrating',
#     'watched',
#     'playcount',
#     'overlay',
#     'cast',
#     'castandrole',
#     'director',
#     'mpaa',
#     'plot',
#     'plotoutline',
#     'title',
#     'originaltitle',
#     'sorttitle',
#     'duration',
#     'studio',
#     'tagline',
#     'writer',
#     'tvshowtitle',
#     'premiered',
#     'status',
#     'set',
#     'setoverview',
#     'tag',
#     'imdbnumber',
#     'code',
#     'aired',
#     'credits',
#     'lastplayed',
#     'album',
#     'artist',
#     'votes',
#     'path',
#     'trailer',
#     'dateadded',
#     'mediatype',
#     'dbid'
# ]
# def get_current_brasilia_utc_offset():
# def get_inputstream_addon():
# def is_inputstream_available():
# def is_live_available():
# def is_vod_available():
# def is_globosat_available():
# def is_globoplay_available():
# def is_globoplay_mais_canais_ao_vivo_available():
# def globoplay_ignore_channel_authorization():
# def is_oiplay_available():
# def is_tntplay_available():
# def is_nowonline_available():
# def is_telecine_available():
# def is_sbt_available():
# def is_pluto_available():
# def getKodiVersion():
# def addonIcon():
# def getBandwidthLimit():
# def addonThumb():
# def addonPoster():
# def addonBanner():
# def addonFanart():
# def addonNext():
# def artPath():
# def okDialog(heading, line1, line2=None, line3=None):
# def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
# def yesnoDialog(line1, line2, line3, heading=addonInfo('name'), nolabel='', yeslabel=''):
# def selectDialog(list, heading=addonInfo('name')):
# def apiLanguage(ret_name=None):
# def version():
# def openSettings(query=None, id=addonInfo('id')):
# def refresh():
# def idle():
# def queueItem():
# def clear_credentials():
# def clear_globosat_credentials():
# def log(msg, level=LOGNOTICE):
# def get_coordinates(affiliate):
# def get_ip_coordinates():
# def get_affiliates_by_id(id):
# def filter_info_labels(info_labels):
# def to_timestamp(date):
# def run_plugin_url(params=None):
# def get_weekday_name(date):


import re
import requests
from resources.lib.modules import control



class Schedule:

    def __init__(self):
        pass

    def get_schedule(self):

        # In Settings.xml - globo_affiliate
        # "0" = All
        # "1" = Rio de Janeiro
        # "2" = Sao Paulo
        # "3" = Brasilia
        # "4" = Belo Horizonte
        # "5" = Recife

        if control.setting("globo_affiliate") == "2":
            affiliate_slug = "sao-paulo"
        elif control.setting("globo_affiliate") == "3":
            affiliate_slug = "distrito-federal"

# Path: resources/lib/modules/control.py
# SORT_METHOD_NONE = xbmcplugin.SORT_METHOD_NONE
# SORT_METHOD_UNSORTED = xbmcplugin.SORT_METHOD_UNSORTED
# SORT_METHOD_VIDEO_RATING = xbmcplugin.SORT_METHOD_VIDEO_RATING
# SORT_METHOD_TRACKNUM = xbmcplugin.SORT_METHOD_TRACKNUM
# SORT_METHOD_FILE = xbmcplugin.SORT_METHOD_FILE
# SORT_METHOD_TITLE = xbmcplugin.SORT_METHOD_TITLE
# SORT_METHOD_TITLE_IGNORE_THE = xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE
# SORT_METHOD_VIDEO_TITLE = xbmcplugin.SORT_METHOD_VIDEO_TITLE
# SORT_METHOD_VIDEO_SORT_TITLE = xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE
# SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE = xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE
# SORT_METHOD_VIDEO_RUNTIME = xbmcplugin.SORT_METHOD_VIDEO_RUNTIME
# SORT_METHOD_FULLPATH = xbmcplugin.SORT_METHOD_FULLPATH
# SORT_METHOD_LABEL = xbmcplugin.SORT_METHOD_LABEL
# SORT_METHOD_LABEL_IGNORE_THE = xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE
# SORT_METHOD_LABEL_IGNORE_FOLDERS = xbmcplugin.SORT_METHOD_LABEL_IGNORE_FOLDERS
# SORT_METHOD_CHANNEL = xbmcplugin.SORT_METHOD_CHANNEL
# SORT_METHOD_DATE = xbmcplugin.SORT_METHOD_DATE
# SORT_METHOD_DATEADDED = xbmcplugin.SORT_METHOD_DATEADDED
# SORT_METHOD_PLAYLIST_ORDER = xbmcplugin.SORT_METHOD_PLAYLIST_ORDER
# SORT_METHOD_EPISODE = xbmcplugin.SORT_METHOD_EPISODE
# SORT_METHOD_STUDIO = xbmcplugin.SORT_METHOD_STUDIO
# SORT_METHOD_STUDIO_IGNORE_THE = xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE
# SORT_METHOD_MPAA_RATING = xbmcplugin.SORT_METHOD_MPAA_RATING
# LOGDEBUG = 0
# LOGERROR = 4
# LOGFATAL = 6
# LOGINFO = 1
# LOGNONE = 7
# LOGNOTICE = 2
# LOGSEVERE = 5
# LOGWARNING = 3
# INFO_LABELS = [
#     'genre',
#     'country',
#     'year',
#     'episode',
#     'season',
#     'sortepisode',
#     'sortseason',
#     'episodeguide',
#     'showlink',
#     'top250',
#     'setid',
#     'tracknumber',
#     'rating',
#     'userrating',
#     'watched',
#     'playcount',
#     'overlay',
#     'cast',
#     'castandrole',
#     'director',
#     'mpaa',
#     'plot',
#     'plotoutline',
#     'title',
#     'originaltitle',
#     'sorttitle',
#     'duration',
#     'studio',
#     'tagline',
#     'writer',
#     'tvshowtitle',
#     'premiered',
#     'status',
#     'set',
#     'setoverview',
#     'tag',
#     'imdbnumber',
#     'code',
#     'aired',
#     'credits',
#     'lastplayed',
#     'album',
#     'artist',
#     'votes',
#     'path',
#     'trailer',
#     'dateadded',
#     'mediatype',
#     'dbid'
# ]
# def get_current_brasilia_utc_offset():
# def get_inputstream_addon():
# def is_inputstream_available():
# def is_live_available():
# def is_vod_available():
# def is_globosat_available():
# def is_globoplay_available():
# def is_globoplay_mais_canais_ao_vivo_available():
# def globoplay_ignore_channel_authorization():
# def is_oiplay_available():
# def is_tntplay_available():
# def is_nowonline_available():
# def is_telecine_available():
# def is_sbt_available():
# def is_pluto_available():
# def getKodiVersion():
# def addonIcon():
# def getBandwidthLimit():
# def addonThumb():
# def addonPoster():
# def addonBanner():
# def addonFanart():
# def addonNext():
# def artPath():
# def okDialog(heading, line1, line2=None, line3=None):
# def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
# def yesnoDialog(line1, line2, line3, heading=addonInfo('name'), nolabel='', yeslabel=''):
# def selectDialog(list, heading=addonInfo('name')):
# def apiLanguage(ret_name=None):
# def version():
# def openSettings(query=None, id=addonInfo('id')):
# def refresh():
# def idle():
# def queueItem():
# def clear_credentials():
# def clear_globosat_credentials():
# def log(msg, level=LOGNOTICE):
# def get_coordinates(affiliate):
# def get_ip_coordinates():
# def get_affiliates_by_id(id):
# def filter_info_labels(info_labels):
# def to_timestamp(date):
# def run_plugin_url(params=None):
# def get_weekday_name(date):


# Path: resources/lib/modules/globoplay/schedule.py
import re
import requests
from resources.lib.modules import control




class Schedule:

    def __init__(self):
        pass

    def get_schedule(self):

        # In Settings.xml - globo_affiliate
        # "0" = All
        # "1" = Rio de Janeiro
        # "2" = Sao Paulo
        # "3" = Brasilia
        # "4" = Belo Horizonte
        # "5" = Recife

        if control.setting("globo_affiliate") == "2":
            affiliate_slug = "sao-paulo"
        elif control.setting("globo_affiliate") == "3":
            affiliate_slug = "distrito-federal"

        elif control.setting("globo_affiliate") == "4":