Example #1
0
    def _build_cache_assist(self):
        if len(self.sources_information["allTorrents"]) == 0:
            return
        valid_packages = ['show', 'season', 'single']

        if self.media_type == 'episode' and self.item_information['is_airing']:
            valid_packages.remove('show')
            if int(self.item_information['info']['season']) >= int(
                    self.item_information['season_count']):
                valid_packages.remove('season')

        sources = [i for i in self.sources_information['allTorrents'].values() if i['package'] in valid_packages]

        if g.get_bool_setting("general.autocache") and g.get_int_setting('general.cacheAssistMode') == 0:
            sources = self._get_best_torrent_to_cache(sources)
            if sources:
                action_args = tools.quote(json.dumps(sources))
                xbmc.executebuiltin(
                    'RunPlugin({}?action=cacheAssist&action_args={})'.format(g.BASE_URL, action_args))
        elif not self.silent:
            confirmation = xbmcgui.Dialog().yesno('{} - {}'.format(g.ADDON_NAME, g.get_language_string(30325)),
                                                  g.get_language_string(30056))
            if confirmation:
                window = ManualCacheWindow(*SkinManager().confirm_skin_path('manual_caching.xml'),
                                           item_information=self.item_information, sources=sources)
                window.doModal()
                del window
Example #2
0
    def _open_manual_cache_assist(self):
        window = ManualCacheWindow(*SkinManager().confirm_skin_path('manual_caching.xml'),
                                   item_information=self.item_information, sources=self.uncached_sources)
        newly_cached_source = window.doModal()
        del window
        if newly_cached_source is None:
            return

        self.sources = [newly_cached_source] + self.sources
        self.onInit()
Example #3
0
    def _open_manual_cache_assist(self):
        newly_cached_source = None
        try:
            window = ManualCacheWindow(
                *SkinManager().confirm_skin_path('manual_caching.xml'),
                item_information=self.item_information,
                sources=self.uncached_sources,
                close_text=g.get_language_string(30624))
            newly_cached_source = window.doModal()
        finally:
            del window

        if newly_cached_source is None:
            return

        self.sources = [newly_cached_source] + self.sources
        self.onInit()