Ejemplo n.º 1
0
def index():
    refresh = arg_as_bool('refresh')
    clear_cache = arg_as_bool('clear-cache')
    if clear_cache:
        include_premium = adobe_activate_api.is_authenticated()
        channel_list = events.get_channel_list(include_premium)
        util.clear_cache(events.get_live_events_url(channel_list))

    current_time = time.strftime("%I:%M %p", time.localtime(time.time()))
    addDirectoryItem(plugin.handle, plugin.url_for(index, refresh=True),
                     ListItem(get_string(30850) % current_time), True)
    include_premium = adobe_activate_api.is_authenticated()
    channel_list = events.get_channel_list(include_premium)
    espn_url = events.get_live_events_url(channel_list)
    legacy.index_legacy_live_events(espn_url)
    if get_setting_as_bool('ShowAndroidTVMenu'):
        url = base64.b64decode(
            'aHR0cHM6Ly93YXRjaC5wcm9kdWN0LmFwaS5lc3BuLmNvbS9hcGkvcHJvZHVjdC92MS9hbmRyb2lkL3R2L2hvbWU='
        )
        addDirectoryItem(plugin.handle, plugin.url_for(page_api_url, url=url),
                         ListItem(get_string(30780)), True)
    if get_setting_as_bool('ShowAppleTVMenu'):
        addDirectoryItem(plugin.handle,
                         plugin.url_for(appletv.appletv_root_menu),
                         ListItem(get_string(30730)), True)
    if get_setting_as_bool('ShowLegacyMenu'):
        addDirectoryItem(plugin.handle, plugin.url_for(legacy_root_menu),
                         ListItem(get_string(30740)), True)
    if get_setting_as_bool('ShowRokuMenu'):
        addDirectoryItem(plugin.handle, plugin.url_for(roku.roku_root_menu),
                         ListItem(get_string(30760)), True)
    if get_setting_as_bool('ShowTVOSMenu'):
        addDirectoryItem(plugin.handle, plugin.url_for(tvos.tvos_root_menu),
                         ListItem(get_string(30750)), True)
    endOfDirectory(plugin.handle, updateListing=refresh, cacheToDisc=False)
Ejemplo n.º 2
0
def ROOT_ITEM(refresh):
    include_premium = adobe_activate_api.is_authenticated()
    channel_list = events.get_channel_list(include_premium)
    legacy_inst = legacy.Legacy()
    espn_url = list()
    espn_url.append(events.get_live_events_url(channel_list))
    legacy_inst.index_legacy_live_events(dict(ESPN_URL=espn_url))
    addDir(translation(30730),
           dict(MODE='/appletv/'),
           defaultlive)
    addDir(translation(30740),
           dict(MODE='/legacy/'),
           defaultlive)
    addDir(translation(30750),
           dict(MODE='/tvos/'),
           defaultlive)
    addDir(translation(30760),
           dict(MODE='/roku/'),
           defaultlive)
    addDir(translation(30780),
           dict(MODE='/androidtv/'),
           defaultlive)
    if not adobe_activate_api.is_authenticated():
        addDir('[COLOR=FFFF0000]' + translation(30300) + '[/COLOR]',
               dict(MODE=AUTHENTICATE_MODE),
               defaultreplay)
    if adobe_activate_api.is_authenticated():
        addDir('[COLOR=FF00FF00]' + translation(30380) + '[/COLOR]',
           dict(MODE=AUTHENTICATION_DETAILS_MODE),
           defaultfanart)
    xbmcplugin.endOfDirectory(pluginhandle, updateListing=refresh)
Ejemplo n.º 3
0
def ROOT_ITEM(refresh):
    if not adobe_activate_api.is_authenticated():
        addDir('[COLOR=FFFF0000]' + translation(30300) + '[/COLOR]',
               dict(MODE=AUTHENTICATE_MODE), defaultreplay)
    current_time = time.strftime("%I:%M %p", time.localtime(time.time()))
    addDir(
        translation(30850) % current_time, dict(MODE=REFRESH_LIVE_MODE),
        defaultlive)
    include_premium = adobe_activate_api.is_authenticated()
    channel_list = events.get_channel_list(include_premium)
    legacy_inst = legacy.Legacy()
    espn_url = list()
    espn_url.append(events.get_live_events_url(channel_list))
    legacy_inst.index_legacy_live_events(dict(ESPN_URL=espn_url))
    if selfAddon.getSetting('ShowAndroidTVMenu') == 'true':
        addDir(translation(30780), dict(MODE='/androidtv/'), defaultlive)
    if selfAddon.getSetting('ShowAppleTVMenu') == 'true':
        addDir(translation(30730), dict(MODE='/appletv/'), defaultlive)
    if selfAddon.getSetting('ShowLegacyMenu') == 'true':
        addDir(translation(30740), dict(MODE='/legacy/'), defaultlive)
    if selfAddon.getSetting('ShowRokuMenu') == 'true':
        addDir(translation(30760), dict(MODE='/roku/'), defaultlive)
    if selfAddon.getSetting('ShowTVOSMenu') == 'true':
        addDir(translation(30750), dict(MODE='/tvos/'), defaultlive)
    if adobe_activate_api.is_authenticated():
        addDir('[COLOR=FF00FF00]' + translation(30380) + '[/COLOR]',
               dict(MODE=AUTHENTICATION_DETAILS_MODE), defaultfanart)
    xbmcplugin.endOfDirectory(pluginhandle,
                              updateListing=refresh,
                              cacheToDisc=False)
Ejemplo n.º 4
0
def ROOT_ITEM(refresh):
    if not adobe_activate_api.is_authenticated():
        addDir('[COLOR=FFFF0000]' + translation(30300) + '[/COLOR]',
               dict(MODE=AUTHENTICATE_MODE),
               defaultreplay)
    current_time = time.strftime("%I:%M %p", time.localtime(time.time()))
    addDir(translation(30850) % current_time,
           dict(MODE=REFRESH_LIVE_MODE),
           defaultlive)
    include_premium = adobe_activate_api.is_authenticated()
    channel_list = events.get_channel_list(include_premium)
    legacy_inst = legacy.Legacy()
    espn_url = list()
    espn_url.append(events.get_live_events_url(channel_list))
    legacy_inst.index_legacy_live_events(dict(ESPN_URL=espn_url))
    if selfAddon.getSetting('ShowAndroidTVMenu') == 'true':
        addDir(translation(30780),
               dict(MODE='/androidtv/'),
               defaultlive)
    if selfAddon.getSetting('ShowAppleTVMenu') == 'true':
        addDir(translation(30730),
               dict(MODE='/appletv/'),
               defaultlive)
    if selfAddon.getSetting('ShowLegacyMenu') == 'true':
        addDir(translation(30740),
               dict(MODE='/legacy/'),
               defaultlive)
    if selfAddon.getSetting('ShowRokuMenu') == 'true':
        addDir(translation(30760),
               dict(MODE='/roku/'),
               defaultlive)
    if selfAddon.getSetting('ShowTVOSMenu') == 'true':
        addDir(translation(30750),
               dict(MODE='/tvos/'),
               defaultlive)
    if adobe_activate_api.is_authenticated():
        addDir('[COLOR=FF00FF00]' + translation(30380) + '[/COLOR]',
           dict(MODE=AUTHENTICATION_DETAILS_MODE),
           defaultfanart)
    xbmcplugin.endOfDirectory(pluginhandle, updateListing=refresh, cacheToDisc=False)
Ejemplo n.º 5
0
def legacy_root_menu():
    include_premium = adobe_activate_api.is_authenticated()
    channel_list = events.get_channel_list(include_premium)
    curdate = datetime.utcnow()
    upcoming = get_setting_as_int('upcoming') + 1
    days = (curdate + timedelta(days=upcoming)).strftime("%Y%m%d")
    # Live
    addDirectoryItem(
        plugin.handle,
        plugin.url_for(live_events_mode,
                       espn_url=events.get_live_events_url(channel_list)),
        make_list_item(get_string(30029)), True)
    # Upcoming
    espn_url = events.get_upcoming_events_url(channel_list) + '&endDate=' + days \
        + '&startDate=' + curdate.strftime("%Y%m%d")
    addDirectoryItem(plugin.handle,
                     plugin.url_for(list_sports, espn_url=espn_url),
                     make_list_item(get_string(30030)), True)
    enddate = '&endDate=' + (curdate + timedelta(days=1)).strftime("%Y%m%d")
    replays1 = [5, 10, 15, 20, 25]
    replays1 = replays1[get_setting_as_int('replays1')]
    start1 = (curdate - timedelta(days=replays1)).strftime("%Y%m%d")
    replays2 = [10, 20, 30, 40, 50]
    replays2 = replays2[get_setting_as_int('replays2')]
    start2 = (curdate - timedelta(days=replays2)).strftime("%Y%m%d")
    replays3 = [30, 60, 90, 120]
    replays3 = replays3[get_setting_as_int('replays3')]
    start3 = (curdate - timedelta(days=replays3)).strftime("%Y%m%d")
    replays4 = [60, 90, 120, 240]
    replays4 = replays4[get_setting_as_int('replays4')]
    start4 = (curdate - timedelta(days=replays4)).strftime("%Y%m%d")
    start_all = (curdate - timedelta(days=365)).strftime("%Y%m%d")
    addDirectoryItem(
        plugin.handle,
        plugin.url_for(list_sports,
                       espn_url=events.get_replay_events_url(channel_list) +
                       enddate + '&startDate=' + start1),
        make_list_item(get_string(30031) % replays1), True)
    addDirectoryItem(
        plugin.handle,
        plugin.url_for(list_sports,
                       espn_url=events.get_replay_events_url(channel_list) +
                       enddate + '&startDate=' + start2),
        make_list_item(get_string(30031) % replays2), True)
    addDirectoryItem(
        plugin.handle,
        plugin.url_for(list_sports,
                       espn_url=events.get_replay_events_url(channel_list) +
                       enddate + '&startDate=' + start3),
        make_list_item(get_string(30031) % replays3), True)
    addDirectoryItem(
        plugin.handle,
        plugin.url_for(list_sports,
                       espn_url=events.get_replay_events_url(channel_list) +
                       '&endDate=' + start3 + '&startDate=' + start4),
        make_list_item(get_string(30033) % (replays3, replays4)), True)
    addDirectoryItem(
        plugin.handle,
        plugin.url_for(list_sports,
                       espn_url=events.get_replay_events_url(channel_list) +
                       enddate + '&startDate=' + start_all),
        make_list_item(get_string(30032)), True)
    xbmcplugin.endOfDirectory(plugin.handle)
Ejemplo n.º 6
0
                             xbmc.LOGDEBUG)
                    if hasattr(method, 'mode'):
                        method_mode = getattr(method, 'mode')
                        xbmc.log(
                            TAG + 'Found method with mode %s' % method_mode,
                            xbmc.LOGDEBUG)
                        if method_mode == path:
                            xbmc.log(TAG + 'Executing method', xbmc.LOGDEBUG)
                            getattr(class_def(), method_name)(args)

if mode is not None and mode[0] == REFRESH_LIVE_MODE:
    mode = None
    refresh = True
    include_premium = adobe_activate_api.is_authenticated()
    channel_list = events.get_channel_list(include_premium)
    util.clear_cache(events.get_live_events_url(channel_list))

if mode is None:
    try:
        adobe_activate_api.clean_up_authorization_tokens()
    except:
        xbmc.log(TAG + 'Unable to clean up')
        adobe_activate_api.reset_settings()
    xbmc.log("Generate Main Menu", xbmc.LOGDEBUG)
    try:
        ROOT_ITEM(refresh)
    except IOError as exception:
        xbmc.log('SSL certificate failure %s' % exception, xbmc.LOGDEBUG)
        xbmc.log(
            '%s-%s-%s' %
            (exception.errno, exception.message, exception.strerror),
Ejemplo n.º 7
0
                for method_name in dir(class_def):
                    method = getattr(class_def, method_name)
                    xbmc.log(TAG + 'Looking at method %s' % method_name, xbmc.LOGDEBUG)
                    if hasattr(method, 'mode'):
                        method_mode = getattr(method, 'mode')
                        xbmc.log(TAG + 'Found method with mode %s' % method_mode, xbmc.LOGDEBUG)
                        if method_mode == path:
                            xbmc.log(TAG + 'Executing method', xbmc.LOGDEBUG)
                            getattr(class_def(), method_name)(args)

if mode is not None and mode[0] == REFRESH_LIVE_MODE:
    mode = None
    refresh = True
    include_premium = adobe_activate_api.is_authenticated()
    channel_list = events.get_channel_list(include_premium)
    util.clear_cache(events.get_live_events_url(channel_list))

if mode is None:
    try:
        adobe_activate_api.clean_up_authorization_tokens()
    except:
        xbmc.log(TAG + 'Unable to clean up')
        adobe_activate_api.reset_settings()
    xbmc.log("Generate Main Menu", xbmc.LOGDEBUG)
    try:
        ROOT_ITEM(refresh)
    except IOError as exception:
        xbmc.log('SSL certificate failure %s' % exception, xbmc.LOGDEBUG)
        xbmc.log('%s-%s-%s' % (exception.errno, exception.message, exception.strerror), xbmc.LOGDEBUG)
        if '[SSL: CERTIFICATE_VERIFY_FAILED]' in str(exception.strerror):
            dialog = xbmcgui.Dialog()