Esempio n. 1
0
def router(paramstring):
    """
    Router function that calls other functions depending on the
    provided paramstring
    """
    params = dict(parse_qsl(paramstring))
    if paramstring:
        if paramstring != 'content_type=video':
            if params['action'] == 'listcategories':
                if params['category'] == 'All Shows':
                    menu.make_series_list(paramstring)
                elif params['category'] == 'Live TV':
                    menu.make_live_list(paramstring)
                else:
                    menu.make_series_list(paramstring)
            elif params['action'] == 'listseries':
                menu.make_episodes_list(paramstring)
            elif params['action'] == 'listepisodes':
                play.play_video(params)
            elif params['action'] == 'listchannels':
                play.play_video(params)
            elif params['action'] == 'settings':
                xbmcaddon.Addon().openSettings()
            elif params['action'] == 'reinstall_widevine_cdm':
                drmhelper.get_widevinecdm()
            elif params['action'] == 'reinstall_ssd_wv':
                drmhelper.get_ssd_wv()
            elif params['action'] == 'sendreport':
                utils.user_report()
            elif params['action'] == 'update_ia':
                addon = drmhelper.get_addon(drm=True)
                if not drmhelper.is_ia_current(addon, latest=True):
                    if xbmcgui.Dialog().yesno(
                        'Upgrade?', ('Newer version of inputstream.adaptive '
                                     'available ({0}) - would you like to '
                                     'upgrade to this version?'.format(
                                        drmhelper.get_latest_ia_ver()))):
                        drmhelper.get_ia_direct(update=True, drm=True)
                else:
                    ver = addon.getAddonInfo('version')
                    utils.dialog_message('Up to date: Inputstream.adaptive '
                                         'version {0} installed and enabled.'
                                         ''.format(ver))
    else:
        menu.list_categories()
def router(paramstring):
    """
    Router function that calls other functions depending on the
    provided paramstring
    """
    params = dict(parse_qsl(paramstring))
    if paramstring:
        if paramstring != 'content_type=video':
            if params['action'] == 'listcategories':
                if params['category'] == 'Live TV':
                    menu.make_live_list(paramstring)
                else:
                    menu.make_series_list(paramstring)
            elif params['action'] == 'listseries':
                menu.make_episodes_list(paramstring)
            elif params['action'] in ['listepisodes', 'listchannels']:
                play.play_video(params)
            elif params['action'] == 'settings':
                xbmcaddon.Addon().openSettings()
            elif params['action'] == 'reinstall_widevine_cdm':
                drmhelper.get_widevinecdm()
            elif params['action'] == 'reinstall_ssd_wv':
                drmhelper.get_ssd_wv()
            elif params['action'] == 'sendreport':
                utils.user_report()
            elif params['action'] == 'update_ia':
                addon = drmhelper.get_addon(drm=True)
                if not drmhelper.is_ia_current(addon, latest=True):
                    if xbmcgui.Dialog().yesno(
                        'Upgrade?', ('Newer version of inputstream.adaptive '
                                     'available ({0}) - would you like to '
                                     'upgrade to this version?'.format(
                                        drmhelper.get_latest_ia_ver()))):
                        drmhelper.get_ia_direct(update=True, drm=True)
                else:
                    ver = addon.getAddonInfo('version')
                    utils.dialog_message('Up to date: Inputstream.adaptive '
                                         'version {0} installed and enabled.'
                                         ''.format(ver))
    else:
        menu.list_categories()
     play.play(params_str)
 elif 'series_url' in params:
     programs.make_programs_list(params_str)
 elif 'category' in params:
     if params['category'] == 'settings':
         xbmcaddon.Addon().openSettings()
     else:
         series.make_series_list(params_str)
 elif 'action' in params:
     if params['action'] == 'sendreport':
         utils.user_report()
     elif params['action'] == 'update_ia':
         try:
             import drmhelper
             addon = drmhelper.get_addon(drm=False)
             if not drmhelper.is_ia_current(addon, latest=True):
                 if xbmcgui.Dialog().yesno(
                         'Upgrade?',
                     ('Newer version of inputstream.adaptive '
                      'available ({0}) - would you like to '
                      'upgrade to this version?'.format(
                          drmhelper.get_latest_ia_ver()))):
                     drmhelper.get_ia_direct(update=True, drm=False)
             else:
                 ver = addon.getAddonInfo('version')
                 utils.dialog_message('Up to date: Inputstream.adaptive '
                                      'version {0} installed and enabled.'
                                      ''.format(ver))
         except ImportError:
             utils.log("Failed to import drmhelper")
             utils.dialog_message('DRM Helper is needed for this function. '
     play.play(params_str)
 elif 'series_url' in params:
     programs.make_programs_list(params_str)
 elif 'category' in params:
     if params['category'] == 'settings':
         xbmcaddon.Addon().openSettings()
     else:
         series.make_series_list(params_str)
 elif 'action' in params:
     if params['action'] == 'sendreport':
         utils.user_report()
     elif params['action'] == 'update_ia':
         try:
             import drmhelper
             addon = drmhelper.get_addon(drm=False)
             if not drmhelper.is_ia_current(addon, latest=True):
                 if xbmcgui.Dialog().yesno(
                     'Upgrade?', ('Newer version of inputstream.adaptive '
                                  'available ({0}) - would you like to '
                                  'upgrade to this version?'.format(
                                     drmhelper.get_latest_ia_ver()))):
                     drmhelper.get_ia_direct(update=True, drm=False)
             else:
                 ver = addon.getAddonInfo('version')
                 utils.dialog_message('Up to date: Inputstream.adaptive '
                                      'version {0} installed and enabled.'
                                      ''.format(ver))
         except ImportError:
             utils.log("Failed to import drmhelper")
             utils.dialog_message('DRM Helper is needed for this function. '
                                  'For more information, please visit: '