def list_discoverdir(self, **kwargs):
        items = []
        params = merge_two_dicts(kwargs, {'info': 'user_discover'})
        artwork = {'thumb': '{}/resources/poster.png'.format(ADDONPATH)}
        for i in ['movie', 'tv']:
            item = {
                'label':
                u'{} {}'.format(ADDON.getLocalizedString(32174),
                                convert_type(i, 'plural')),
                'params':
                merge_two_dicts(params, {'tmdb_type': i}),
                'infoproperties': {
                    'specialsort': 'top'
                },
                'art':
                artwork
            }
            items.append(item)

        history = get_search_history('discover')
        history.reverse()
        for x, i in enumerate(history):
            item_params = merge_two_dicts(kwargs, i.get('params', {}))
            edit_params = {
                'info': 'user_discover',
                'tmdb_type': item_params.get('tmdb_type'),
                'method': 'edit',
                'idx': x
            }
            name_params = {
                'info': 'dir_discover',
                'tmdb_type': item_params.get('tmdb_type'),
                'method': 'rename',
                'idx': x
            }
            dele_params = {
                'info': 'dir_discover',
                'tmdb_type': item_params.get('tmdb_type'),
                'method': 'delete',
                'idx': x
            }
            item = {
                'label':
                i.get('label'),
                'params':
                item_params,
                'art':
                artwork,
                'context_menu':
                [(xbmc.getLocalizedString(21435),
                  'Container.Update({})'.format(
                      encode_url(PLUGINPATH, **edit_params))),
                 (xbmc.getLocalizedString(118), 'Container.Update({})'.format(
                     encode_url(PLUGINPATH, **name_params))),
                 (xbmc.getLocalizedString(117), 'Container.Update({})'.format(
                     encode_url(PLUGINPATH, **dele_params)))]
            }
            items.append(item)
        if history:
            item = {
                'label':
                ADDON.getLocalizedString(32237),
                'art':
                artwork,
                'params':
                merge_two_dicts(params, {
                    'info': 'dir_discover',
                    'clear_cache': 'True'
                })
            }
            items.append(item)
        return items
 def get_container_content(self, tmdb_type, season=None, episode=None):
     if tmdb_type == 'tv' and season and episode:
         return convert_type('episode', 'container')
     elif tmdb_type == 'tv' and season:
         return convert_type('season', 'container')
     return convert_type(tmdb_type, 'container')
Beispiel #3
0
 def list_all_items(self, tmdb_type, page=None, **kwargs):
     items = self.tmdb_api.get_all_items_list(tmdb_type, page=page)
     self.kodi_db = self.get_kodi_database(tmdb_type)
     self.library = convert_type(tmdb_type, 'library')
     self.container_content = convert_type(tmdb_type, 'container')
     return items
Beispiel #4
0
 def list_episodes(self, tmdb_id, season, **kwargs):
     items = self.tmdb_api.get_episode_list(tmdb_id, season)
     self.kodi_db = self.get_kodi_database('tv')
     self.container_content = convert_type('episode', 'container')
     return items
Beispiel #5
0
 def list_seasons(self, tmdb_id, **kwargs):
     items = self.tmdb_api.get_season_list(
         tmdb_id, special_folders=ADDON.getSettingInt('special_folders'))
     self.container_content = convert_type('season', 'container')
     return items
Beispiel #6
0
 def list_episode_groups(self, tmdb_id, **kwargs):
     items = self.tmdb_api.get_episode_groups_list(tmdb_id)
     self.container_content = convert_type('tv', 'container')
     return items
Beispiel #7
0
 def list_episode_group_episodes(self, tmdb_id, group_id, position,
                                 **kwargs):
     items = self.tmdb_api.get_episode_group_episodes_list(
         tmdb_id, group_id, position)
     self.container_content = convert_type('episode', 'container')
     return items