def _create_videolist_item(list_id,
                           video_list,
                           menu_data,
                           common_data,
                           static_lists=False):
    if static_lists and G.is_known_menu_context(video_list['context']):
        pathitems = list(menu_data['path'])  # Make a copy
        pathitems.append(video_list['context'])
    else:
        # It is a dynamic video list / menu context
        if menu_data.get('force_use_videolist_id', False):
            path = 'video_list'
        else:
            path = 'video_list_sorted'
        pathitems = [path, menu_data['path'][1], list_id]
    list_item = ListItemW(label=video_list['displayName'])
    add_info_list_item(list_item,
                       video_list.videoid,
                       video_list,
                       video_list.data,
                       False,
                       common_data,
                       art_item=video_list.artitem)
    # Add possibility to browse the sub-genres (see build_video_listing)
    sub_genre_id = video_list.get('genreId')
    params = {'sub_genre_id': str(sub_genre_id)} if sub_genre_id else None
    return common.build_url(pathitems, params=params,
                            mode=G.MODE_DIRECTORY), list_item, True
def _create_videolist_item(list_id,
                           video_list,
                           menu_data,
                           common_data,
                           static_lists=False):
    if static_lists and G.is_known_menu_context(video_list['context']):
        pathitems = list(menu_data['path'])  # Make a copy
        pathitems.append(video_list['context'])
    else:
        # It is a dynamic video list / menu context
        if menu_data.get('force_use_videolist_id', False):
            path = 'video_list'
        else:
            path = 'video_list_sorted'
        pathitems = [path, menu_data['path'][1], list_id]
    dict_item = {'label': video_list['displayName'], 'is_folder': True}
    add_info_dict_item(dict_item, video_list.videoid, video_list,
                       video_list.data, False, common_data)
    dict_item['art'] = get_art(video_list.videoid, video_list.artitem,
                               common_data['profile_language_code'])
    dict_item['url'] = common.build_url(
        pathitems,
        # genre_id add possibility to browse the sub-genres (see build_video_listing)
        # Todo: Disabled sub-genre menu due to website changes
        # params={'genre_id': unicode(video_list.get('genreId'))},
        mode=G.MODE_DIRECTORY)
    return dict_item
예제 #3
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])
        }
        list_data, 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(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_type)

        end_of_directory(self.dir_update_listing)
        return menu_data.get('view')
예제 #4
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')