예제 #1
0
    def __init__(self, xml_file, location, actionArgs=None):
        super(BaseWindow, self).__init__(xml_file, location)
        if actionArgs is None:
            return

        tools.closeBusyDialog()

        self.canceled = False
        self.item_information = tools.get_item_information(actionArgs)

        self.setProperty('texture.white',
                         os.path.join(tools.IMAGES_PATH, 'white.png'))
        self.setProperty('seren.logo', tools.SEREN_LOGO_PATH)
        self.setProperty('settings.color', tools.get_user_text_color())
        self.setProperty('test_pattern',
                         os.path.join(tools.IMAGES_PATH, 'test_pattern.png'))

        for i in self.item_information['art'].keys():
            self.setProperty('item.art.%s' % i,
                             str(self.item_information['art'][i]))

        for i in self.item_information['info'].keys():
            value = self.item_information['info'][i]
            if i == 'aired' or i == 'premiered':
                value = value[:10]
            try:
                self.setProperty('item.info.%s' % i, str(value))
            except UnicodeEncodeError:
                self.setProperty('item.info.%s' % i, value)
    def flip_mutliple_providers(self,
                                status,
                                provider_type=None,
                                package_name=None):

        tools.showBusyDialog()
        providers = self.providers

        if package_name:
            providers = [i for i in providers if i['package'] == package_name]

        if provider_type:
            providers = [
                i for i in providers if i['provider_type'] == provider_type
            ]

        for i in providers:
            self.providers_class.flip_provider_status(i['package'],
                                                      i['provider_name'],
                                                      status)

        self.providers = database.get_providers()
        self.fill_providers(self.package_list.getSelectedItem().getLabel())

        tools.closeBusyDialog()
    def onInit(self):
        tools.closeBusyDialog()
        self.provider_list = self.getControl(2001)
        self.package_list = self.getControl(2000)

        self.fill_packages()
        self.fill_providers(self.package_list.getSelectedItem().getLabel())
        self.setFocus(self.package_list)
    def __init__(self, xml_file, location, actionArgs=None):

        super(PersistentBackground, self).__init__(xml_file, location, actionArgs=actionArgs)

        if actionArgs is None:
            return

        tools.closeBusyDialog()
예제 #5
0
 def __init__(self, xml_file, location, actionArgs=None, sources=None, **kwargs):
     super(SourceSelect, self).__init__(xml_file, location, actionArgs=actionArgs)
     self.actionArgs = actionArgs
     self.sources = sources
     self.position = -1
     self.canceled = False
     self.display_list = None
     self.last_action = 0
     tools.closeBusyDialog()
     self.stream_link = None
예제 #6
0
 def __init__(self, xml_file, location, actionArgs=None, sources=None, **kwargs):
     super(SourceSelect, self).__init__(xml_file, location, actionArgs=actionArgs)
     self.actionArgs = actionArgs
     self.sources = sources
     self.position = -1
     self.canceled = False
     self.display_list = None
     tools.closeBusyDialog()
     self.Resolver = Resolver('resolver.xml', tools.addonDir, actionArgs=actionArgs)
     self.stream_link = None
예제 #7
0
    def play_source(self, stream_link, args, resume_time=None, params=None):
        try:
            self.pre_cache_initiated = False
            if resume_time is not None:
                self.offset = float(resume_time)

            self.params = params

            if stream_link is None:
                tools.cancelPlayback()
                raise Exception

            self.playing_file = stream_link
            self.original_action_args = args
            self.smart_module = smartPlay.SmartPlay(self.original_action_args)

            args = tools.get_item_information(args)
            self.args = args

            if 'showInfo' in args:
                self.media_type = 'episode'
                # Workaround for estuary skin to allow episode information to be displayed in Video Top Info
                args['art']['tvshow.clearlogo'] = args['art'].get(
                    'clearlogo', '')
            else:
                self.media_type = 'movie'

            self.trakt_id = args['ids']['trakt']

            orginalArgs = json.loads(tools.unquote(self.original_action_args))

            if 'resume' in orginalArgs:
                if orginalArgs['resume'] == 'true':
                    self.tryGetBookmark()

            self.handleBookmark()

            item = tools.menuItem(path=stream_link)
            args['info']['FileNameAndPath'] = tools.unquote(stream_link)
            item.setInfo(type='video', infoLabels=args['info'])
            item.setArt(args['art'])
            item.setCast(args['cast'])
            item.setUniqueIDs(args['ids'])

            tools.closeBusyDialog()
            tools.closeAllDialogs()

            tools.resolvedUrl(syshandle, True, item)

            self.keepAlive()

        except:
            traceback.print_exc()
            pass
 def __init__(self, xml_file, xml_location, actionArgs=None):
     super(GetSources, self).__init__(xml_file, xml_location, actionArgs=actionArgs)
     self.setProperty('process_started', 'false')
     self.position = -1
     self.canceled = False
     self.display_list = None
     self.return_data = None
     self.args = actionArgs
     self.progress = 0
     self.background_dialog = None
     self.setProperty('progress', '0')
     self.setProperty('loading.ico', os.path.join(tools.IMAGES_PATH, 'loading2.gif'))
     self.setProperty('ico.trans.upper', os.path.join(tools.IMAGES_PATH, 'trans-fox-upper.png'))
     self.setProperty('ico.trans.lower', os.path.join(tools.IMAGES_PATH, 'trans-fox-lower.png'))
     tools.closeBusyDialog()
예제 #9
0
    def play_source(self, stream_link, args):

        try:
            self.pre_cache_initiated = False
            if stream_link is None:
                tools.cancelPlayback()
                raise Exception
            self.original_action_args = args

            args = tools.get_item_information(args)

            self.args = args

            item = tools.menuItem(path=stream_link)

            if 'showInfo' in args:
                self.media_type = 'episode'
                self.trakt_id = args['ids']['trakt']
                item.setArt(args['art'])
                item.setUniqueIDs(args['ids'])
                item.setInfo(type='video', infoLabels=args['info'])
            else:
                self.media_type = 'movie'
                self.trakt_id = args['ids']['trakt']
                item.setUniqueIDs(args['ids'])
                item.setArt(args['art'])
                item.setInfo(type='video', infoLabels=args['info'])

            if tools.playList.getposition() == 0 and tools.getSetting('smartPlay.traktresume') == 'true' \
                    and tools.getSetting('trakt.auth') is not '':
                tools.log('Getting Trakt Resume Point', 'info')
                self.traktBookmark()

            tools.resolvedUrl(syshandle, True, item)

            self.keepAlive()

            try:
                tools.closeBusyDialog()
            except:
                pass

        except:
            import traceback
            traceback.print_exc()
예제 #10
0
    def __init__(self, xml_file, xml_location, actionArgs=None):
        try:
            super(GetSources, self).__init__(xml_file,
                                             xml_location,
                                             actionArgs=actionArgs)
        except:
            BaseWindow(xml_file, xml_location).__init__(xml_file, xml_location)

        self.setProperty('process_started', 'false')
        self.position = -1
        self.canceled = False
        self.display_list = None
        self.return_data = None
        self.args = actionArgs
        self.progress = 0
        self.background_dialog = None
        self.setProperty('progress', '0')
        tools.closeBusyDialog()
예제 #11
0
 def close_dialog(self):
     tools.closeBusyDialog()
     self.closed = True
     self.close()
예제 #12
0
    def handle_action(self, action):

        focus_id = self.getFocusId()

        if (action == 4 or action == 3 or action == 7) and focus_id == 2000:
            # UP/ DOWN
            self.fill_providers(self.package_list.getSelectedItem().getLabel())

        if action == 92 or action == 10:
            # BACKSPACE / ESCAPE
            self.close()

        if action == 7:
            if focus_id == 2001:
                self.flip_provider_status()
            if focus_id == 3001:
                self.flip_mutliple_providers('enabled',
                                             provider_type='hosters')
            if focus_id == 3002:
                self.flip_mutliple_providers('enabled',
                                             provider_type='torrent')
            if focus_id == 3003:
                self.flip_mutliple_providers('disabled',
                                             provider_type='hosters')
            if focus_id == 3004:
                self.flip_mutliple_providers('disabled',
                                             provider_type='torrent')
            if focus_id == 3005:
                self.flip_mutliple_providers('enabled')
            if focus_id == 3006:
                self.flip_mutliple_providers('disabled')
            if focus_id == 3007:
                self.flip_mutliple_providers('enabled',
                                             package_name=self.package_list.
                                             getSelectedItem().getLabel())
            if focus_id == 3008:
                self.flip_mutliple_providers('disabled',
                                             package_name=self.package_list.
                                             getSelectedItem().getLabel())
            if focus_id == 3009:
                tools.showBusyDialog()

                self.providers_class.install_package(None)
                self.packages = database.get_provider_packages()
                self.fill_packages()
                try:
                    current_package = self.package_list.getSelectedItem(
                    ).getLabel()
                    self.fill_providers(current_package)
                except:
                    self.provider_list.reset()
                    pass
                tools.closeBusyDialog()
                self.setFocus(self.package_list)
            if focus_id == 3010:
                try:
                    package = self.package_list.getSelectedItem().getLabel()
                except:
                    return
                tools.showBusyDialog()
                confirm = tools.showDialog.yesno(tools.addonName,
                                                 tools.lang(40255) % package)
                if not confirm:
                    tools.closeBusyDialog()
                    return

                self.providers_class.uninstall_package(
                    package=self.package_list.getSelectedItem().getLabel(),
                    silent=True)
                self.packages = database.get_provider_packages()
                self.fill_packages()
                self.fill_providers()
                tools.closeBusyDialog()
                self.setFocus(self.package_list)
            pass

        if action == 0:
            pass
예제 #13
0
    def __init__(self, xml_file, location, actionArgs=None):

        try:
            super(BaseWindow, self).__init__(xml_file, location)
        except:
            tools.xmlWindow().__init__()

        tools.closeBusyDialog()
        self.canceled = False

        self.setProperty('texture.white',
                         os.path.join(tools.IMAGES_PATH, 'white.png'))
        self.setProperty('seren.logo', tools.SEREN_LOGO_PATH)
        self.setProperty('seren.fanart', tools.SEREN_FANART_PATH)
        self.setProperty('settings.color', tools.get_user_text_color())
        self.setProperty('test_pattern',
                         os.path.join(tools.IMAGES_PATH, 'test_pattern.png'))
        self.setProperty('skin.dir',
                         SkinManager().confirm_skin_path(xml_file)[1])

        if actionArgs is None:
            return

        self.item_information = tools.get_item_information(actionArgs)

        for id, value in self.item_information['ids'].items():
            self.setProperty('item.ids.%s_id' % id, str(value))

        for i in self.item_information['art'].keys():
            self.setProperty('item.art.%s' % i,
                             str(self.item_information['art'][i]))

        self.item_information['info'] = tools.clean_air_dates(
            self.item_information['info'])

        year, month, day = self.item_information['info'].get(
            'aired', '0000-00-00').split('-')

        self.setProperty('item.info.aired.year', year)
        self.setProperty('item.info.aired.month', month)
        self.setProperty('item.info.aired.day', day)

        try:
            if 'aired' in self.item_information['info']:
                aired_date = self.item_information['info']['aired']
                aired_date = tools.datetime_workaround(aired_date)
                aired_date = aired_date.strftime(tools.get_region('dateshort'))
                self.item_information['info']['aired'] = aired_date

            if 'premiered' in self.item_information['info']:
                premiered = self.item_information['info']['premiered']
                premiered = tools.datetime_workaround(premiered)
                premiered = premiered.strftime(tools.get_region('dateshort'))
                self.item_information['info']['premiered'] = premiered
        except:
            pass

        for i in self.item_information['info'].keys():
            value = self.item_information['info'][i]
            if i == 'aired' or i == 'premiered':
                try:
                    value = value[:10]
                except:
                    value = 'TBA'
            if i == 'duration':
                try:
                    hours = int(value) % 60
                    self.setProperty('item.info.%s.minutes' % i,
                                     str(int(value) - (hours * 60)))
                    self.setProperty('item.info.%s.hours' % i, str(hours))
                except:
                    pass
            try:
                self.setProperty('item.info.%s' % i, str(value))
            except UnicodeEncodeError:
                self.setProperty('item.info.%s' % i, value)
예제 #14
0
    def __init__(self):
        self.return_data = 'Nothing'

        tools.closeBusyDialog()
        self.canceled = False
        text = ''
        background_image = ''

        background_image = os.path.join(tools.IMAGES_PATH, 'background.png')

        texture_path = os.path.join(tools.IMAGES_PATH, 'texture.png')
        background_diffuse = '0x1FFFFFFF'
        self.perc_on_path = os.path.join(tools.IMAGES_PATH, 'on.png')
        self.perc_off_path = os.path.join(tools.IMAGES_PATH, 'off.png')
        self.texture = tools.imageControl(0, 0, 1280, 720, texture_path)
        self.addControl(self.texture)
        self.background = tools.imageControl(0, 0, 1280, 720, background_image)
        self.background.setColorDiffuse(background_diffuse)

        self.addControl(self.background)

        self.panda_logo = tools.imageControl(605, 330, 70, 60,
                                             tools.PANDA_LOGO_PATH)
        self.addControl(self.panda_logo)

        lpx = 570
        lpy = 410

        self.perc10 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc20 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc30 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc40 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc50 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc60 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc70 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc80 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc90 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)
        lpx += 15
        self.perc100 = tools.imageControl(lpx, lpy, 10, 10, self.perc_off_path)

        self.addControl(self.perc10)
        self.addControl(self.perc20)
        self.addControl(self.perc30)
        self.addControl(self.perc40)
        self.addControl(self.perc50)
        self.addControl(self.perc60)
        self.addControl(self.perc70)
        self.addControl(self.perc80)
        self.addControl(self.perc90)
        self.addControl(self.perc100)

        self.text_label = tools.labelControl(0,
                                             430,
                                             1280,
                                             50,
                                             str(text),
                                             font='font13',
                                             alignment=tools.XBFONT_CENTER_X)
        self.text_label2 = tools.labelControl(0,
                                              470,
                                              1280,
                                              50,
                                              "",
                                              font='font13',
                                              alignment=tools.XBFONT_CENTER_X)
        self.text_label3 = tools.labelControl(0,
                                              510,
                                              1280,
                                              50,
                                              "",
                                              font='font13',
                                              alignment=tools.XBFONT_CENTER_X)

        self.addControl(self.text_label)
        self.addControl(self.text_label2)
        self.addControl(self.text_label3)
예제 #15
0
def api(params):

    from resources.lib.common import tools
    from resources.lib.modules import database

    tools.SETTINGS_CACHE = {}

    try:

        url = params.get('url')

        action = params.get('action')

        page = params.get('page')

        actionArgs = params.get('actionArgs')

        pack_select = params.get('packSelect')

        source_select = params.get('source_select')

        seren_reload = params.get('seren_reload')

        if seren_reload == 'true':
            seren_reload = True

    except:

        print('Welcome to console mode')
        print('Command Help:')
        print('   - Menu Number: opens the relevant menu page')
        print('   - shell: opens a interactive python shell within Seren')
        print('   - action xxx: run a custom Seren URL argument')

        url = ''

        action = None

        page = ''

        actionArgs = ''

        pack_select = ''

        source_select = ''

        seren_reload = ''

    unit_tests = params.get('unit_tests', False)

    if unit_tests:
        tools.enable_unit_tests()

    tools.log('Seren, Running Path - Action: %s, actionArgs: %s' %
              (action, actionArgs))

    if action == None:
        from resources.lib.gui import homeMenu

        homeMenu.Menus().home()

    if action == 'smartPlay':
        from resources.lib.modules import smartPlay
        smartPlay.SmartPlay(actionArgs).fill_playlist()

    if action == 'playbackResume':
        from resources.lib.modules import smartPlay

        smart = smartPlay.SmartPlay(actionArgs)
        smart.workaround()

    if action == 'moviesHome':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().discoverMovies()

    if action == 'moviesPopular':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesPopular(page)

    if action == 'moviesTrending':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesTrending(page)

    if action == 'moviesPlayed':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesPlayed(page)

    if action == 'moviesWatched':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesWatched(page)

    if action == 'moviesCollected':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesCollected(page)

    if action == 'moviesAnticipated':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesAnticipated(page)

    if action == 'moviesBoxOffice':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesBoxOffice()

    if action == 'moviesUpdated':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesUpdated(page)

    if action == 'moviesRecommended':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesRecommended()

    if action == 'moviesSearch':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesSearch(actionArgs)

    if action == 'moviesSearchResults':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesSearchResults(actionArgs)

    if action == 'moviesSearchHistory':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesSearchHistory()

    if action == 'myMovies':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().myMovies()

    if action == 'moviesMyCollection':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().myMovieCollection()

    if action == 'moviesMyWatchlist':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().myMovieWatchlist()

    if action == 'moviesRelated':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesRelated(actionArgs)

    if action == 'colorPicker':
        tools.colorPicker()

    if action == 'authTrakt':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().auth()

    if action == 'revokeTrakt':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().revokeAuth()

    if action == 'getSources':

        try:
            from resources.lib.gui.windows.persistent_background import PersistentBackground
            item_information = tools.get_item_information(actionArgs)

            # Assume if we couldn't get information using the normal method, that it's the legacy method
            if item_information is None:
                item_information = actionArgs

            if not tools.premium_check():
                tools.showDialog.ok(tools.addonName, tools.lang(40146),
                                    tools.lang(40147))
                return None

            if tools.playList.getposition() == 0 and tools.getSetting(
                    'general.scrapedisplay') == '0':
                display_background = True
            else:
                display_background = False

            if tools.getSetting('general.scrapedisplay') == '1':
                tools.closeBusyDialog()

            if display_background:
                background = PersistentBackground('persistent_background.xml',
                                                  tools.addonDir,
                                                  actionArgs=actionArgs)
                background.setText(tools.lang(32045))
                background.show()

            from resources.lib.modules import getSources

            uncached_sources, source_results, args = database.get(
                getSources.getSourcesHelper,
                1,
                actionArgs,
                seren_reload=seren_reload,
                seren_sources=True)
            if len(source_results) <= 0:
                tools.showDialog.notification(tools.addonName,
                                              tools.lang(32047),
                                              time=5000)
                return

            if 'showInfo' in item_information:
                source_select_style = 'Episodes'
            else:
                source_select_style = 'Movie'

            if tools.getSetting(
                    'general.playstyle%s' %
                    source_select_style) == '1' or source_select == 'true':
                try:
                    background.setText(tools.lang(40135))
                except:
                    pass

                from resources.lib.modules import sourceSelect

                stream_link = sourceSelect.sourceSelect(
                    uncached_sources, source_results, actionArgs)

                if stream_link is None:
                    tools.showDialog.notification(tools.addonName,
                                                  tools.lang(32047),
                                                  time=5000)
                    raise Exception
            else:
                try:
                    background.setText(tools.lang(32046))
                except:
                    pass

                from resources.lib.modules import resolver

                resolver_window = resolver.Resolver('resolver.xml',
                                                    tools.addonDir,
                                                    actionArgs=actionArgs)
                stream_link = database.get(resolver_window.doModal,
                                           1,
                                           source_results,
                                           args,
                                           pack_select,
                                           seren_reload=seren_reload)
                del resolver_window

                if stream_link is None:
                    tools.closeBusyDialog()
                    tools.showDialog.notification(tools.addonName,
                                                  tools.lang(32047),
                                                  time=5000)
                    raise Exception

            try:
                background.close()
            except:
                pass
            try:
                del background
            except:
                pass

            from resources.lib.modules import player

            player.serenPlayer().play_source(stream_link, actionArgs)

        except:
            # Perform cleanup and make sure all open windows close and playlist is cleared
            try:
                tools.closeBusyDialog()
            except:
                pass
            try:
                background.close()
            except:
                pass
            try:
                del background
            except:
                pass
            try:
                sources_window.close()
            except:
                pass
            try:
                del sources_window
            except:
                pass
            try:
                resolver_window.close()
            except:
                pass
            try:
                del resolver_window
            except:
                pass
            try:
                tools.playList.clear()
            except:
                pass
            try:
                tools.closeOkDialog()
            except:
                pass
            try:
                tools.cancelPlayback()
            except:
                pass

    if action == 'preScrape':
        try:
            item_information = tools.get_item_information(actionArgs)

            if 'showInfo' in item_information:
                source_select_style = 'Episodes'
            else:
                source_select_style = 'Movie'

            from resources.lib.modules import getSources

            uncached_sources, source_results, args = database.get(
                getSources.getSourcesHelper,
                1,
                actionArgs,
                seren_reload=seren_reload,
                seren_sources=True)

            if tools.getSetting('general.playstyle%s' %
                                source_select_style) == '0':
                from resources.lib.modules import resolver

                from resources.lib.modules import resolver

                resolver_window = resolver.Resolver('resolver.xml',
                                                    tools.addonDir,
                                                    actionArgs=actionArgs)
                database.get(resolver_window.doModal,
                             1,
                             source_results,
                             args,
                             pack_select,
                             seren_reload=seren_reload)

            tools.setSetting(id='general.tempSilent', value='false')
        except:
            tools.setSetting(id='general.tempSilent', value='false')
            import traceback

            traceback.print_exc()
            pass
        tools.log('Pre-scraping completed')

    if action == 'authRealDebrid':
        from resources.lib.debrid import real_debrid

        real_debrid.RealDebrid().auth()

    if action == 'showsHome':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().discoverShows()

    if action == 'myShows':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myShows()

    if action == 'showsMyCollection':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myShowCollection()

    if action == 'showsMyWatchlist':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myShowWatchlist()

    if action == 'showsMyProgress':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myProgress()

    if action == 'showsMyRecentEpisodes':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myRecentEpisodes()

    if action == 'showsPopular':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsPopular(page)

    if action == 'showsRecommended':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsRecommended()

    if action == 'showsTrending':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsTrending(page)

    if action == 'showsPlayed':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsPlayed(page)

    if action == 'showsWatched':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsWatched(page)

    if action == 'showsCollected':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsCollected(page)

    if action == 'showsAnticipated':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsAnticipated(page)

    if action == 'showsUpdated':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsUpdated(page)

    if action == 'showsSearch':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsSearch(actionArgs)

    if action == 'showsSearchResults':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsSearchResults(actionArgs)

    if action == 'showsSearchHistory':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showSearchHistory()

    if action == 'showSeasons':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showSeasons(actionArgs)

    if action == 'seasonEpisodes':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().seasonEpisodes(actionArgs)

    if action == 'showsRelated':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsRelated(actionArgs)

    if action == 'showYears':
        from resources.lib.gui import tvshowMenus
        tvshowMenus.Menus().showYears(actionArgs, page)

    if action == 'searchMenu':
        from resources.lib.gui import homeMenu

        homeMenu.Menus().searchMenu()

    if action == 'toolsMenu':
        from resources.lib.gui import homeMenu

        homeMenu.Menus().toolsMenu()

    if action == 'clearCache':
        from resources.lib.common import tools

        tools.clearCache()

    if action == 'traktManager':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().traktManager(actionArgs)

    if action == 'onDeckShows':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().onDeckShows()

    if action == 'onDeckMovies':
        from resources.lib.gui.movieMenus import Menus

        Menus().onDeckMovies()

    if action == 'cacheAssist':
        from resources.lib.modules import cacheAssist

        cacheAssist.CacheAssit(actionArgs)

    if action == 'tvGenres':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showGenres()

    if action == 'showGenresGet':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showGenreList(actionArgs, page)

    if action == 'movieGenres':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().movieGenres()

    if action == 'movieGenresGet':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().movieGenresList(actionArgs, page)

    if action == 'filePicker':
        from resources.lib.modules import smartPlay

        smartPlay.SmartPlay(actionArgs).torrent_file_picker()

    if action == 'shufflePlay':
        from resources.lib.modules import smartPlay

        try:
            smart = smartPlay.SmartPlay(actionArgs).shufflePlay()
        except:
            import traceback
            traceback.print_exc()
            pass

    if action == 'resetSilent':
        tools.setSetting('general.tempSilent', 'false')
        tools.showDialog.notification(tools.addonName + ": Silent scrape",
                                      tools.lang(32048),
                                      time=5000)

    if action == 'clearTorrentCache':
        from resources.lib.modules import database

        database.torrent_cache_clear()

    if action == 'openSettings':
        tools.execute('Addon.OpenSettings(%s)' % tools.addonInfo('id'))

    if action == 'myTraktLists':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().myTraktLists(actionArgs)

    if action == 'traktList':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().getListItems(actionArgs, page)

    if action == 'nonActiveAssistClear':
        from resources.lib.gui import debridServices

        debridServices.Menus().assist_non_active_clear()

    if action == 'debridServices':
        from resources.lib.gui import debridServices

        debridServices.Menus().home()

    if action == 'cacheAssistStatus':
        from resources.lib.gui import debridServices

        debridServices.Menus().get_assist_torrents()

    if action == 'premiumizeTransfers':
        from resources.lib.gui import debridServices

        debridServices.Menus().list_premiumize_transfers()

    if action == 'showsNextUp':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myNextUp()

    if action == 'runMaintenance':
        from resources.lib.common import maintenance

        maintenance.run_maintenance()

    if action == 'providerTools':
        from resources.lib.gui import homeMenu

        homeMenu.Menus().providerMenu()

    if action == 'adjustProviders':
        from resources.lib.modules import customProviders

        customProviders.providers().adjust_providers(actionArgs)

    if action == 'adjustPackage':
        from resources.lib.modules import customProviders

        customProviders.providers().adjust_providers(actionArgs,
                                                     package_disable=True)

    if action == 'installProviders':
        from resources.lib.modules import customProviders

        customProviders.providers().install_package(actionArgs)

    if action == 'uninstallProviders':
        from resources.lib.modules import customProviders

        customProviders.providers().uninstall_package()

    if action == 'showsNew':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().newShows()

    if action == 'realdebridTransfers':
        from resources.lib.gui import debridServices

        debridServices.Menus().list_RD_transfers()

    if action == 'cleanInstall':
        from resources.lib.common import maintenance

        maintenance.wipe_install()

    if action == 'buildPlaylistWorkaround':

        from resources.lib.modules import smartPlay
        smartPlay.SmartPlay(actionArgs).resume_playback()

    if action == 'premiumizeCleanup':
        from resources.lib.common import maintenance

        maintenance.premiumize_transfer_cleanup()

    if action == 'test2':
        tools.log('Nope')

    if action == 'manualProviderUpdate':
        from resources.lib.modules import customProviders

        customProviders.providers().manual_update()

    if action == 'clearSearchHistory':
        from resources.lib.modules import database

        database.clearSearchHistory()
        tools.showDialog.ok(tools.addonName, 'Search History has been cleared')

    if action == 'externalProviderInstall':
        from resources.lib.modules import customProviders

        confirmation = tools.showDialog.yesno(tools.addonName,
                                              tools.lang(40117))
        if confirmation == 0:
            sys.exit()

        customProviders.providers().install_package(1, url=url)

    if action == 'externalProviderUninstall':
        from resources.lib.modules import customProviders

        confirmation = tools.showDialog.yesno(tools.addonName,
                                              tools.lang(40119) % url)
        if confirmation == 0:
            sys.exit()

        customProviders.providers().uninstall_package(package=url,
                                                      silent=False)

    if action == 'showsNetworks':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsNetworks()

    if action == 'showsNetworkShows':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsNetworkShows(actionArgs, page)

    if action == 'movieYears':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().movieYears()

    if action == 'movieYearsMovies':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().movieYearsMovies(actionArgs, page)

    if action == 'syncTraktActivities':
        from resources.lib.modules.trakt_sync.activities import TraktSyncDatabase
        TraktSyncDatabase().sync_activities()

    if action == 'traktSyncTools':
        from resources.lib.gui import homeMenu
        homeMenu.Menus().traktSyncTools()

    if action == 'flushTraktActivities':
        from resources.lib.modules import trakt_sync
        trakt_sync.TraktSyncDatabase().flush_activities()

    if action == 'flushTraktDBMeta':
        from resources.lib.modules import trakt_sync
        trakt_sync.TraktSyncDatabase().clear_all_meta()

    if action == 'myFiles':
        from resources.lib.gui import myFiles
        myFiles.Menus().home()

    if action == 'myFilesFolder':
        from resources.lib.gui import myFiles
        myFiles.Menus().myFilesFolder(actionArgs)

    if action == 'myFilesPlay':
        from resources.lib.gui import myFiles
        myFiles.Menus().myFilesPlay(actionArgs)

    if action == 'forceTraktSync':
        from resources.lib.modules import trakt_sync
        from resources.lib.modules.trakt_sync.activities import TraktSyncDatabase
        trakt_sync.TraktSyncDatabase().flush_activities()
        TraktSyncDatabase().sync_activities()

    if action == 'rebuildTraktDatabase':
        from resources.lib.modules.trakt_sync import TraktSyncDatabase
        TraktSyncDatabase().re_build_database()

    if action == 'myUpcomingEpisodes':
        from resources.lib.gui import tvshowMenus
        tvshowMenus.Menus().myUpcomingEpisodes()

    if action == 'showsByActor':
        from resources.lib.gui import tvshowMenus
        tvshowMenus.Menus().showsByActor(actionArgs)

    if action == 'movieByActor':
        from resources.lib.gui import movieMenus
        movieMenus.Menus().moviesByActor(actionArgs)

    if action == 'playFromRandomPoint':
        from resources.lib.modules import smartPlay
        smartPlay.SmartPlay(actionArgs).play_from_random_point()

    if action == 'refreshProviders':
        from resources.lib.modules.customProviders import providers
        providers().update_known_providers()

    if unit_tests:
        items = tools.xbmcplugin.DIRECTORY.items
        tools.xbmcplugin.DIRECTORY.items = []
        return items
예제 #16
0
                    tools.playList.clear()
                except:
                    pass
                pass
            else:
                from resources.lib.modules import player
                player.serenPlayer().play_source(stream_link, args)
        else:
            if display_background is True:
                background.close()
                del background
            tools.showDialog.notification(tools.addonName,
                                          'No playable sources found for item',
                                          time=5000)
            try:
                tools.closeBusyDialog()
            except:
                pass
    except:
        import traceback
        traceback.print_exc()
        try:
            tools.busyDialog.close()
        except:
            pass

        try:
            tools.playList.clear()
        except:
            pass
예제 #17
0
def dispatch(params):
    from resources.lib.common import tools
    from resources.lib.modules import database

    tools.SETTINGS_CACHE = {}

    try:

        url = params.get('url')

        action = params.get('action')

        page = params.get('page')

        actionArgs = params.get('actionArgs')

        pack_select = params.get('packSelect')

        source_select = params.get('source_select')

        seren_reload = True if params.get('seren_reload') == 'true' else False

        resume = params.get('resume')

        forceresumeoff = True if params.get(
            'forceresumeoff') == 'true' else False

        forceresumeon = True if params.get(
            'forceresumeon') == 'true' else False

        smartPlay = True if params.get('smartPlay') == 'true' else False

    except:

        print('Welcome to console mode')
        print('Command Help:')
        print('   - Menu Number: opens the relevant menu page')
        print('   - shell: opens a interactive python shell within Seren')
        print('   - action xxx: run a custom Seren URL argument')

        url = ''

        action = None

        page = ''

        actionArgs = ''

        pack_select = ''

        source_select = ''

        seren_reload = ''

        resume = None

        forceresumeoff = True if params.get(
            'forceresumeoff') == 'true' else False

        forceresumeon = True if params.get(
            'forceresumeon') == 'true' else False

        smartPlay = True if params.get('smartPlay') == 'true' else False

    tools.log('Seren, Running Path - Action: %s, actionArgs: %s' %
              (action, actionArgs))

    if action is None:
        from resources.lib.gui import homeMenu

        homeMenu.Menus().home()

    if action == 'smartPlay':
        from resources.lib.modules import smartPlay
        # if 'resume' not in actionArgs:
        #     actionArgs = json.loads(actionArgs)
        #     actionArgs['resume'] = sys.argv[3].split(':')[-1]
        #     actionArgs = tools.quote(json.dumps(actionArgs, sort_keys=True))
        smartPlay.SmartPlay(actionArgs).fill_playlist()

    if action == 'playbackResume':
        from resources.lib.modules import smartPlay
        smart = smartPlay.SmartPlay(actionArgs)
        smart.workaround()

    if action == 'moviesHome':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().discoverMovies()

    if action == 'moviesPopular':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesPopular(page)

    if action == 'moviesTrending':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesTrending(page)

    if action == 'moviesPlayed':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesPlayed(page)

    if action == 'moviesWatched':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesWatched(page)

    if action == 'moviesCollected':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesCollected(page)

    if action == 'moviesAnticipated':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesAnticipated(page)

    if action == 'moviesBoxOffice':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesBoxOffice()

    if action == 'moviesUpdated':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesUpdated(page)

    if action == 'moviesRecommended':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesRecommended()

    if action == 'moviesSearch':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesSearch(actionArgs)

    if action == 'moviesSearchResults':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesSearchResults(actionArgs)

    if action == 'moviesSearchHistory':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesSearchHistory()

    if action == 'myMovies':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().myMovies()

    if action == 'moviesMyCollection':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().myMovieCollection()

    if action == 'moviesMyWatchlist':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().myMovieWatchlist()

    if action == 'moviesRelated':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().moviesRelated(actionArgs)

    if action == 'colorPicker':
        tools.colorPicker()

    if action == 'authTrakt':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().auth()

    if action == 'revokeTrakt':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().revokeAuth()

    if action == 'getSources':

        try:

            item_information = tools.get_item_information(actionArgs)
            #
            # This tomfoolery here is the new workaround for Seren to skip the building playlist window

            if tools.getSetting(
                    'smartplay.playlistcreate') == 'true' or smartPlay:

                if tools.playList.size() > 0:
                    playlist_uris = [
                        tools.playList[i].getPath()
                        for i in range(tools.playList.size())
                    ]
                else:
                    playlist_uris = []

                if ('showInfo' in item_information and tools.playList.size() == 0) \
                        or not any(sys.argv[2] in i for i in playlist_uris):

                    try:
                        name = item_information['info']['title']
                        item = tools.addDirectoryItem(
                            name,
                            'getSources',
                            item_information['info'],
                            item_information['art'],
                            item_information['cast'],
                            isFolder=False,
                            isPlayable=True,
                            actionArgs=actionArgs,
                            bulk_add=True,
                            set_ids=item_information['ids'])
                        tools.cancelPlayback()
                        tools.playList.add(url=sys.argv[0] + sys.argv[2],
                                           listitem=item[1])
                        tools.player().play(tools.playList)
                        return
                    except:
                        import traceback
                        traceback.print_exc()
                        return

            bookmark_style = tools.getSetting('general.bookmarkstyle')

            if tools.playList.size(
            ) == 1 and resume is not None and bookmark_style != '2' and not forceresumeoff:

                if bookmark_style == '0' and not forceresumeon:
                    import datetime
                    selection = tools.showDialog.contextmenu([
                        '{} {}'.format(
                            tools.lang(32092),
                            datetime.timedelta(seconds=int(resume))),
                        tools.lang(40350)
                    ])
                    if selection == -1:
                        tools.cancelPlayback()
                        sys.exit()
                    elif selection != 0:
                        resume = None
            else:
                resume = None

            # Assume if we couldn't get information using the normal method, that it's the legacy method
            if item_information is None:
                item_information = actionArgs

            if not tools.premium_check():
                tools.showDialog.ok(tools.addonName, tools.lang(40146),
                                    tools.lang(40147))
                return None

            if tools.playList.getposition() == 0 and tools.getSetting(
                    'general.scrapedisplay') == '0':
                display_background = True
            else:
                display_background = False

            from resources.lib.modules.skin_manager import SkinManager

            if display_background:
                from resources.lib.gui.windows.persistent_background import PersistentBackground
                background = PersistentBackground(
                    *SkinManager().confirm_skin_path(
                        'persistent_background.xml'),
                    actionArgs=actionArgs)
                background.setText(tools.lang(32045))
                background.show()

            from resources.lib.modules import getSources

            uncached_sources, source_results, args = database.get(
                getSources.getSourcesHelper,
                1,
                actionArgs,
                seren_reload=seren_reload,
                seren_sources=True)
            if len(source_results) <= 0:
                tools.showDialog.notification(tools.addonName,
                                              tools.lang(32047),
                                              time=5000)
                return

            if 'showInfo' in item_information:
                source_select_style = 'Episodes'
            else:
                source_select_style = 'Movie'

            if tools.getSetting(
                    'general.playstyle%s' %
                    source_select_style) == '1' or source_select == 'true':

                try:
                    background.setText(tools.lang(40135))
                except:
                    pass

                from resources.lib.modules import sourceSelect

                stream_link = sourceSelect.sourceSelect(
                    uncached_sources, source_results, actionArgs)

                if stream_link is None:
                    tools.showDialog.notification(tools.addonName,
                                                  tools.lang(32047),
                                                  time=5000)
                    raise Exception
                if not stream_link:
                    # user has backed out of source select, don't show no playable sources notification
                    raise Exception
            else:
                try:
                    background.setText(tools.lang(32046))
                except:
                    pass

                from resources.lib.modules import resolver

                resolver_window = resolver.Resolver(
                    *SkinManager().confirm_skin_path('resolver.xml'),
                    actionArgs=actionArgs)

                stream_link = database.get(resolver_window.doModal,
                                           1,
                                           source_results,
                                           args,
                                           pack_select,
                                           seren_reload=seren_reload)
                del resolver_window

                if stream_link is None:
                    tools.closeBusyDialog()
                    tools.showDialog.notification(tools.addonName,
                                                  tools.lang(32047),
                                                  time=5000)
                    raise Exception

            tools.showBusyDialog()
            try:
                background.close()
            except:
                pass
            try:
                del background
            except:
                pass

            from resources.lib.modules import player

            # if 'resume' not in actionArgs:
            #     actionArgs = json.loads(actionArgs)
            #     actionArgs['resume'] = sys.argv[3].split(':')[-1]
            #     actionArgs = json.dumps(actionArgs, sort_keys=True)

            player.serenPlayer().play_source(stream_link,
                                             actionArgs,
                                             resume_time=resume,
                                             params=params)

        except:
            import traceback
            traceback.print_exc()
            # Perform cleanup and make sure all open windows close and playlist is cleared
            try:
                tools.closeBusyDialog()
            except:
                pass
            try:
                background.close()
            except:
                pass
            try:
                del background
            except:
                pass
            try:
                resolver_window.close()
            except:
                pass
            try:
                del resolver_window
            except:
                pass
            try:
                tools.playList.clear()
            except:
                pass
            try:
                tools.closeOkDialog()
            except:
                pass
            try:
                tools.cancelPlayback()
            except:
                pass

    if action == 'preScrape':

        from resources.lib.modules.skin_manager import SkinManager

        try:
            item_information = tools.get_item_information(actionArgs)

            if 'showInfo' in item_information:
                source_select_style = 'Episodes'
            else:
                source_select_style = 'Movie'

            from resources.lib.modules import getSources

            uncached_sources, source_results, args = database.get(
                getSources.getSourcesHelper,
                1,
                actionArgs,
                seren_reload=seren_reload,
                seren_sources=True)

            if tools.getSetting('general.playstyle%s' %
                                source_select_style) == '0':
                from resources.lib.modules import resolver

                resolver_window = resolver.Resolver(
                    *SkinManager().confirm_skin_path('resolver.xml'),
                    actionArgs=actionArgs)
                database.get(resolver_window.doModal,
                             1,
                             source_results,
                             args,
                             pack_select,
                             seren_reload=seren_reload)

            tools.setSetting(id='general.tempSilent', value='false')
        except:
            tools.setSetting(id='general.tempSilent', value='false')
            import traceback

            traceback.print_exc()
            pass

        tools.log('Pre-scraping completed')

    if action == 'authRealDebrid':
        from resources.lib.debrid import real_debrid

        real_debrid.RealDebrid().auth()

    if action == 'showsHome':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().discoverShows()

    if action == 'myShows':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myShows()

    if action == 'showsMyCollection':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myShowCollection()

    if action == 'showsMyWatchlist':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myShowWatchlist()

    if action == 'showsMyProgress':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myProgress()

    if action == 'showsMyRecentEpisodes':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myRecentEpisodes()

    if action == 'showsPopular':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsPopular(page)

    if action == 'showsRecommended':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsRecommended()

    if action == 'showsTrending':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsTrending(page)

    if action == 'showsPlayed':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsPlayed(page)

    if action == 'showsWatched':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsWatched(page)

    if action == 'showsCollected':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsCollected(page)

    if action == 'showsAnticipated':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsAnticipated(page)

    if action == 'showsUpdated':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsUpdated(page)

    if action == 'showsSearch':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsSearch(actionArgs)

    if action == 'showsSearchResults':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsSearchResults(actionArgs)

    if action == 'showsSearchHistory':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showSearchHistory()

    if action == 'showSeasons':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showSeasons(actionArgs)

    if action == 'seasonEpisodes':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().seasonEpisodes(actionArgs)

    if action == 'showsRelated':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsRelated(actionArgs)

    if action == 'showYears':
        from resources.lib.gui import tvshowMenus
        tvshowMenus.Menus().showYears(actionArgs, page)

    if action == 'searchMenu':
        from resources.lib.gui import homeMenu

        homeMenu.Menus().searchMenu()

    if action == 'toolsMenu':
        from resources.lib.gui import homeMenu

        homeMenu.Menus().toolsMenu()

    if action == 'clearCache':
        from resources.lib.common import tools

        tools.clearCache()

    if action == 'traktManager':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().traktManager(actionArgs)

    if action == 'onDeckShows':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().onDeckShows()

    if action == 'onDeckMovies':
        from resources.lib.gui.movieMenus import Menus

        Menus().onDeckMovies()

    if action == 'cacheAssist':
        from resources.lib.modules import cacheAssist

        cacheAssist.CacheAssit(actionArgs)

    if action == 'tvGenres':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showGenres()

    if action == 'showGenresGet':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showGenreList(actionArgs, page)

    if action == 'movieGenres':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().movieGenres()

    if action == 'movieGenresGet':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().movieGenresList(actionArgs, page)

    if action == 'filePicker':
        from resources.lib.modules import smartPlay

        smartPlay.SmartPlay(actionArgs).torrent_file_picker()

    if action == 'shufflePlay':
        from resources.lib.modules import smartPlay

        try:
            smart = smartPlay.SmartPlay(actionArgs).shufflePlay()
        except:
            import traceback
            traceback.print_exc()
            pass

    if action == 'resetSilent':
        tools.setSetting('general.tempSilent', 'false')
        tools.showDialog.notification('{}: {}'.format(tools.addonName,
                                                      tools.lang(40296)),
                                      tools.lang(32048),
                                      time=5000)

    if action == 'clearTorrentCache':
        from resources.lib.modules import database

        database.torrent_cache_clear()

    if action == 'openSettings':
        tools.execute('Addon.OpenSettings(%s)' % tools.addonInfo('id'))

    if action == 'myTraktLists':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().myTraktLists(actionArgs)

    if action == 'traktList':
        from resources.lib.indexers import trakt

        trakt.TraktAPI().getListItems(actionArgs, page)

    if action == 'nonActiveAssistClear':
        from resources.lib.gui import debridServices

        debridServices.Menus().assist_non_active_clear()

    if action == 'debridServices':
        from resources.lib.gui import debridServices

        debridServices.Menus().home()

    if action == 'cacheAssistStatus':
        from resources.lib.gui import debridServices

        debridServices.Menus().get_assist_torrents()

    if action == 'premiumizeTransfers':
        from resources.lib.gui import debridServices

        debridServices.Menus().list_premiumize_transfers()

    if action == 'showsNextUp':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().myNextUp()

    if action == 'runMaintenance':
        from resources.lib.common import maintenance

        maintenance.run_maintenance()

    if action == 'providerTools':
        from resources.lib.gui import homeMenu

        homeMenu.Menus().providerMenu()

    if action == 'adjustProviders':
        tools.log('adjustProviders endpoint has been deprecated')
        return
        # from resources.lib.modules import customProviders
        #
        # customProviders.providers().adjust_providers(actionArgs)

    if action == 'adjustPackage':
        tools.log('adjustPackage endpoint has been deprecated')
        return
        # DEPRECATED
        # from resources.lib.modules import customProviders
        #
        # customProviders.providers().adjust_providers(actionArgs, package_disable=True)

    if action == 'installProviders':
        from resources.lib.modules import customProviders

        customProviders.providers().install_package(actionArgs)

    if action == 'uninstallProviders':
        from resources.lib.modules import customProviders

        customProviders.providers().uninstall_package()

    if action == 'showsNew':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().newShows()

    if action == 'realdebridTransfers':
        from resources.lib.gui import debridServices

        debridServices.Menus().list_RD_transfers()

    if action == 'cleanInstall':
        from resources.lib.common import maintenance

        maintenance.wipe_install()

    if action == 'buildPlaylistWorkaround':
        from resources.lib.modules import smartPlay
        smartPlay.SmartPlay(actionArgs).resume_playback()

    if action == 'premiumizeCleanup':
        from resources.lib.common import maintenance

        maintenance.premiumize_transfer_cleanup()

    if action == 'test2':
        pass

    if action == 'manualProviderUpdate':
        from resources.lib.modules import customProviders

        customProviders.providers().manual_update()

    if action == 'clearSearchHistory':
        from resources.lib.modules import database

        database.clearSearchHistory()

    if action == 'externalProviderInstall':
        from resources.lib.modules import customProviders

        confirmation = tools.showDialog.yesno(tools.addonName,
                                              tools.lang(40117))
        if confirmation == 0:
            sys.exit()

        customProviders.providers().install_package(1, url=url)

    if action == 'externalProviderUninstall':
        from resources.lib.modules import customProviders

        confirmation = tools.showDialog.yesno(tools.addonName,
                                              tools.lang(40119) % url)
        if confirmation == 0:
            sys.exit()

        customProviders.providers().uninstall_package(package=url,
                                                      silent=False)

    if action == 'showsNetworks':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsNetworks()

    if action == 'showsNetworkShows':
        from resources.lib.gui import tvshowMenus

        tvshowMenus.Menus().showsNetworkShows(actionArgs, page)

    if action == 'movieYears':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().movieYears()

    if action == 'movieYearsMovies':
        from resources.lib.gui import movieMenus

        movieMenus.Menus().movieYearsMovies(actionArgs, page)

    if action == 'syncTraktActivities':
        from resources.lib.modules.trakt_sync.activities import TraktSyncDatabase
        TraktSyncDatabase().sync_activities()

    if action == 'traktSyncTools':
        from resources.lib.gui import homeMenu
        homeMenu.Menus().traktSyncTools()

    if action == 'flushTraktActivities':
        from resources.lib.modules import trakt_sync
        trakt_sync.TraktSyncDatabase().flush_activities()

    if action == 'flushTraktDBMeta':
        from resources.lib.modules import trakt_sync
        trakt_sync.TraktSyncDatabase().clear_all_meta()

    if action == 'myFiles':
        from resources.lib.gui import myFiles
        myFiles.Menus().home()

    if action == 'myFilesFolder':
        from resources.lib.gui import myFiles
        myFiles.Menus().myFilesFolder(actionArgs)

    if action == 'myFilesPlay':
        from resources.lib.gui import myFiles
        myFiles.Menus().myFilesPlay(actionArgs)

    if action == 'forceTraktSync':
        from resources.lib.modules import trakt_sync
        from resources.lib.modules.trakt_sync.activities import TraktSyncDatabase
        trakt_sync.TraktSyncDatabase().flush_activities()
        TraktSyncDatabase().sync_activities()

    if action == 'rebuildTraktDatabase':
        from resources.lib.modules.trakt_sync import TraktSyncDatabase
        TraktSyncDatabase().re_build_database()

    if action == 'myUpcomingEpisodes':
        from resources.lib.gui import tvshowMenus
        tvshowMenus.Menus().myUpcomingEpisodes()

    if action == 'myWatchedEpisodes':
        from resources.lib.gui import tvshowMenus
        tvshowMenus.Menus().myWatchedEpisodes(page)

    if action == 'myWatchedMovies':
        from resources.lib.gui import movieMenus
        movieMenus.Menus().myWatchedMovies(page)

    if action == 'showsByActor':
        from resources.lib.gui import tvshowMenus
        tvshowMenus.Menus().showsByActor(actionArgs)

    if action == 'movieByActor':
        from resources.lib.gui import movieMenus
        movieMenus.Menus().moviesByActor(actionArgs)

    if action == 'playFromRandomPoint':
        from resources.lib.modules import smartPlay
        smartPlay.SmartPlay(actionArgs).play_from_random_point()

    if action == 'refreshProviders':
        from resources.lib.modules.customProviders import providers
        providers().update_known_providers()

    if action == 'installSkin':
        from resources.lib.modules.skin_manager import SkinManager
        SkinManager().install_skin()

    if action == 'uninstallSkin':
        from resources.lib.modules.skin_manager import SkinManager
        SkinManager().uninstall_skin()

    if action == 'switchSkin':
        from resources.lib.modules.skin_manager import SkinManager
        SkinManager().switch_skin()

    if action == 'manageProviders':
        tools.showBusyDialog()
        from resources.lib.gui.windows.custom_providers import CustomProviders
        from resources.lib.modules.skin_manager import SkinManager
        CustomProviders(*SkinManager().confirm_skin_path(
            'custom_providers.xml')).doModal()

    if action == 'flatEpisodes':
        from resources.lib.gui.tvshowMenus import Menus
        Menus().flat_episode_list(actionArgs)

    if action == 'runPlayerDialogs':
        from resources.lib.modules.player import PlayerDialogs
        try:
            PlayerDialogs().display_dialog()
        except:
            import traceback
            traceback.print_exc()

    if action == 'authAllDebrid':
        from resources.lib.debrid.all_debrid import AllDebrid
        AllDebrid().auth()

    if action == 'checkSkinUpdates':
        from resources.lib.modules.skin_manager import SkinManager
        SkinManager().check_for_updates()

    if action == 'authPremiumize':
        from resources.lib.debrid.premiumize import Premiumize
        Premiumize().auth()