예제 #1
0
    def subgenres(self, pathitems):
        """Show a lists of sub-genres of a 'genre id'"""
        menu_data = G.MAIN_MENU_ITEMS[pathitems[1]]
        call_args = {'menu_data': menu_data, 'genre_id': pathitems[2]}
        list_data, extra_data = common.make_call('get_subgenres', call_args)

        finalize_directory(convert_list_to_dir_items(list_data),
                           menu_data.get('content_type', G.CONTENT_SHOW),
                           title=get_title(menu_data, extra_data),
                           sort_type='sort_label')
        end_of_directory(False)
        return menu_data.get('view')
예제 #2
0
 def _episodes(self, videoid, pathitems):
     """Show the episodes list of a season"""
     call_args = {
         'pathitems': pathitems,
         'seasonid_dict': videoid.to_dict(),
         'perpetual_range_start': self.perpetual_range_start,
     }
     dir_items, extra_data = common.make_call('get_episodes', call_args)
     finalize_directory(dir_items, G.CONTENT_EPISODE, 'sort_episodes',
                        title=extra_data.get('title', ''))
     end_of_directory(self.dir_update_listing)
     auto_scroll(dir_items)
예제 #3
0
    def category_list(self, pathitems):
        """Show a list of folders of a LoLoMo category"""
        menu_data = G.MAIN_MENU_ITEMS.get(pathitems[1])
        call_args = {
            'menu_data': menu_data
        }
        dir_items, extra_data = common.make_call('get_category_list', call_args)

        finalize_directory(dir_items, menu_data.get('content_type', G.CONTENT_FOLDER),
                           title=get_title(menu_data, extra_data), sort_type='sort_label')
        end_of_directory(self.dir_update_listing)
        return menu_data.get('view')
예제 #4
0
    def _seasons(self, videoid, pathitems):
        """Show the seasons list of a tv show"""
        call_args = {
            'pathitems': pathitems,
            'tvshowid_dict': videoid.to_dict(),
            'perpetual_range_start': self.perpetual_range_start,
        }
        list_data, extra_data = common.make_call('get_seasons', call_args)

        finalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_SEASON, 'sort_only_label',
                           title=extra_data.get('title', ''))
        end_of_directory(self.dir_update_listing)
예제 #5
0
 def home(self, pathitems=None, cache_to_disc=True, is_autoselect_profile=False):  # pylint: disable=unused-argument
     """Show home listing"""
     if not is_autoselect_profile and 'switch_profile_guid' in self.params:
         # This is executed only when you have selected a profile from the profile list
         if not activate_profile(self.params['switch_profile_guid']):
             xbmcplugin.endOfDirectory(G.PLUGIN_HANDLE, succeeded=False)
             return
     LOG.debug('Showing home listing')
     list_data, extra_data = common.make_call('get_mainmenu')  # pylint: disable=unused-variable
     finalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_FOLDER,
                        title=(G.LOCAL_DB.get_profile_config('profileName', '???') +
                               ' - ' + common.get_local_string(30097)))
     end_of_directory(True, cache_to_disc)
예제 #6
0
def search_list(dir_update_listing=False):
    """Show the list of search item (main directory)"""
    list_data = [
        _create_dictitem_from_row(row) for row in G.LOCAL_DB.get_search_list()
    ]
    list_data.insert(0, _get_dictitem_add())
    list_data.append(_get_dictitem_clear())
    sort_type = 'sort_nothing'
    if G.ADDON.getSettingInt('menu_sortorder_search_history') == 1:
        sort_type = 'sort_label_ignore_folders'
    finalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_FOLDER,
                       sort_type, common.get_local_string(30400))
    end_of_directory(dir_update_listing)
예제 #7
0
    def recommendations(self, pathitems):
        """Show video lists for a genre"""
        menu_data = G.MAIN_MENU_ITEMS.get(pathitems[1])
        call_args = {
            'menu_data': menu_data,
            'genre_id': None,
            'force_use_videolist_id': True,
        }
        list_data, extra_data = common.make_call('get_genres', call_args)

        finalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_FOLDER,
                           title=get_title(menu_data, extra_data), sort_type='sort_label')
        end_of_directory(False)
        return menu_data.get('view')
예제 #8
0
    def _exported_directory(self, pathitems, chunked_video_list, perpetual_range_selector):
        menu_data = G.MAIN_MENU_ITEMS['exported']
        call_args = {
            'pathitems': pathitems,
            'menu_data': menu_data,
            'chunked_video_list': chunked_video_list,
            'perpetual_range_selector': perpetual_range_selector
        }
        list_data, extra_data = common.make_call('get_video_list_chunked', call_args)

        finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', G.CONTENT_SHOW),
                           title=get_title(menu_data, extra_data))
        end_of_directory(self.dir_update_listing)
        return menu_data.get('view')
예제 #9
0
 def home(self, pathitems=None):  # pylint: disable=unused-argument
     """Show home listing"""
     if 'switch_profile_guid' in self.params and G.CURRENT_LOADED_DIRECTORY in [
             None, 'root', 'profiles'
     ]:
         if not activate_profile(self.params['switch_profile_guid']):
             xbmcplugin.endOfDirectory(G.PLUGIN_HANDLE, succeeded=False)
             return
     LOG.debug('Showing home listing')
     list_data, extra_data = common.make_call('get_mainmenu')  # pylint: disable=unused-variable
     finalize_directory(
         convert_list_to_dir_items(list_data),
         G.CONTENT_FOLDER,
         title=(G.LOCAL_DB.get_profile_config('profileName', '???') +
                ' - ' + common.get_local_string(30097)))
     end_of_directory(True)
예제 #10
0
    def supplemental(self, pathitems):  # pylint: disable=unused-argument
        """Show supplemental video list (eg. trailers) of a tv show / movie"""
        menu_data = {'path': ['is_context_menu_item', 'is_context_menu_item'],  # Menu item do not exists
                     'title': common.get_local_string(30179)}
        from json import loads
        call_args = {
            'menu_data': menu_data,
            'video_id_dict': loads(self.params['video_id_dict']),
            'supplemental_type': self.params['supplemental_type']
        }
        list_data, extra_data = common.make_call('get_video_list_supplemental', call_args)

        finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', G.CONTENT_SHOW),
                           title=get_title(menu_data, extra_data))
        end_of_directory(self.dir_update_listing)
        return menu_data.get('view')
예제 #11
0
    def video_list(self, pathitems):
        """Show a video list of a list ID"""
        menu_data = G.MAIN_MENU_ITEMS.get(pathitems[1])
        if not menu_data:  # Dynamic menus
            menu_data = G.LOCAL_DB.get_value(pathitems[1], table=TABLE_MENU_DATA, data_type=dict)
        call_args = {
            'list_id': pathitems[2],
            'menu_data': menu_data,
            'is_dynamic_id': not G.is_known_menu_context(pathitems[2])
        }
        list_data, extra_data = common.make_call('get_video_list', call_args)

        finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', G.CONTENT_SHOW),
                           title=get_title(menu_data, extra_data))
        end_of_directory(False)
        return menu_data.get('view')
예제 #12
0
    def genres(self, pathitems):
        """Show loco list of a genre or from loco root the list of contexts specified in the menu data"""
        menu_data = G.MAIN_MENU_ITEMS.get(pathitems[1])
        if not menu_data:  # Dynamic menus
            menu_data = G.LOCAL_DB.get_value(pathitems[1], table=TABLE_MENU_DATA, data_type=dict)
        call_args = {
            'menu_data': menu_data,
            # When genre_id is None is loaded the loco root the list of contexts specified in the menu data
            'genre_id': None if len(pathitems) < 3 else int(pathitems[2]),
            'force_use_videolist_id': False,
        }
        list_data, extra_data = common.make_call('get_genres', call_args)

        finalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_FOLDER,
                           title=get_title(menu_data, extra_data), sort_type='sort_label')
        end_of_directory(False)
        return menu_data.get('view')
예제 #13
0
 def home(self, pathitems=None):  # pylint: disable=unused-argument
     """Show home listing"""
     if 'switch_profile_guid' in self.params:
         if G.IS_ADDON_EXTERNAL_CALL:
             # Profile switch/ask PIN only once
             ret = not self.params['switch_profile_guid'] == G.LOCAL_DB.get_active_profile_guid()
         else:
             # Profile switch/ask PIN every time you come from ...
             ret = common.WndHomeProps[common.WndHomeProps.CURRENT_DIRECTORY] in ['', 'root', 'profiles']
         if ret and not activate_profile(self.params['switch_profile_guid']):
             xbmcplugin.endOfDirectory(G.PLUGIN_HANDLE, succeeded=False)
             return
     LOG.debug('Showing home listing')
     dir_items, extra_data = common.make_call('get_mainmenu')  # pylint: disable=unused-variable
     finalize_directory(dir_items, G.CONTENT_FOLDER,
                        title=(G.LOCAL_DB.get_profile_config('profileName', '???') +
                               ' - ' + common.get_local_string(30097)))
     end_of_directory(True)
예제 #14
0
    def video_list_sorted(self, pathitems):
        """Show a video list sorted of a 'context' name"""
        menu_data = G.MAIN_MENU_ITEMS.get(pathitems[1])
        if not menu_data:  # Dynamic menus
            menu_data = G.LOCAL_DB.get_value(pathitems[1], table=TABLE_MENU_DATA, data_type=dict)
        call_args = {
            'pathitems': pathitems,
            'menu_data': menu_data,
            'sub_genre_id': self.params.get('sub_genre_id'),  # Used to show the sub-genre folder when sub-genres exists
            'perpetual_range_start': self.perpetual_range_start,
            'is_dynamic_id': not G.is_known_menu_context(pathitems[2])
        }
        dir_items, extra_data = common.make_call('get_video_list_sorted', call_args)
        sort_type = 'sort_nothing'
        if menu_data['path'][1] == 'myList' and int(G.ADDON.getSettingInt('menu_sortorder_mylist')) == 0:
            # At the moment it is not possible to make a query with results sorted for the 'mylist',
            # so we adding the sort order of kodi
            sort_type = 'sort_label_ignore_folders'

        finalize_directory(dir_items, menu_data.get('content_type', G.CONTENT_SHOW),
                           title=get_title(menu_data, extra_data), sort_type=sort_type)
        end_of_directory(self.dir_update_listing)
        return menu_data.get('view')
예제 #15
0
 def _profiles(self, list_data, extra_data):  # pylint: disable=unused-argument
     # The standard kodi theme does not allow to change view type if the content is "files" type,
     # so here we use "images" type, visually better to see
     finalize_directory(convert_list_to_dir_items(list_data),
                        G.CONTENT_IMAGES)
     end_of_directory(True)
예제 #16
0
 def _seasons_directory(self, list_data, extra_data):
     finalize_directory(convert_list_to_dir_items(list_data),
                        G.CONTENT_SEASON,
                        'sort_only_label',
                        title=extra_data.get('title', ''))
     end_of_directory(self.dir_update_listing)
예제 #17
0
def _search_results_directory(search_value, menu_data, list_data, extra_data, dir_update_listing):
    extra_data['title'] = common.get_local_string(30400) + ' - ' + search_value
    finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', G.CONTENT_SHOW),
                       title=get_title(menu_data, extra_data))
    end_of_directory(dir_update_listing)
    return menu_data.get('view')