Esempio n. 1
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(
                'genre_id'
            ),  # Used to show the sub-genre folder (when sub-genre 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(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')
Esempio n. 2
0
def _search_results_directory(pathitems, menu_data, list_data, extra_data,
                              dir_update_listing):
    extra_data['title'] = common.get_local_string(30011) + ' - ' + pathitems[2]
    finalize_directory(convert_list(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')
Esempio n. 3
0
    def profiles(self, pathitems=None):  # pylint: disable=unused-argument
        """Show profiles listing"""
        common.debug('Showing profiles listing')
        list_data, extra_data = common.make_call('get_profiles')  # pylint: disable=unused-variable

        # 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(list_data), g.CONTENT_IMAGES)
        end_of_directory(False, False)
Esempio n. 4
0
    def home(self, pathitems=None, cache_to_disc=True):  # pylint: disable=unused-argument
        """Show home listing"""
        common.debug('Showing home listing')
        list_data, extra_data = common.make_call('get_mainmenu')  # pylint: disable=unused-variable

        finalize_directory(
            convert_list(list_data),
            g.CONTENT_FOLDER,
            title=(g.LOCAL_DB.get_profile_config('profileName', '???') +
                   ' - ' + common.get_local_string(30097)))
        end_of_directory(False, cache_to_disc)
Esempio n. 5
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(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')
Esempio n. 6
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,
        }
        list_data, extra_data = common.make_call('get_episodes', call_args)

        finalize_directory(convert_list(list_data),
                           g.CONTENT_EPISODE,
                           'sort_episodes',
                           title=extra_data.get('title', ''))
        end_of_directory(self.dir_update_listing)
Esempio n. 7
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(list_data),
                           g.CONTENT_SEASON,
                           'sort_only_label',
                           title=extra_data.get('title', ''))
        end_of_directory(self.dir_update_listing)
Esempio n. 8
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(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')
Esempio n. 9
0
    def home(self, pathitems=None, cache_to_disc=True):  # pylint: disable=unused-argument
        """Show home listing"""
        if 'switch_profile_guid' in self.params:
            # This is executed only when you have selected a profile from the profile list
            if not self._activate_profile(self.params['switch_profile_guid']):
                xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False)
                return
        common.debug('Showing home listing')
        list_data, extra_data = common.make_call('get_mainmenu')  # pylint: disable=unused-variable

        finalize_directory(
            convert_list(list_data),
            g.CONTENT_FOLDER,
            title=(g.LOCAL_DB.get_profile_config('profileName', '???') +
                   ' - ' + common.get_local_string(30097)))
        end_of_directory(False, cache_to_disc)
Esempio n. 10
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(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')
Esempio n. 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(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')
Esempio n. 12
0
    def genres(self, pathitems):
        """Show lolomo list of a genre or from lolomo 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 lolomo root the list of contexts specified in the menu data
            'genre_id': None if len(pathitems) < 3 else pathitems[2],
            'force_use_videolist_id': False,
        }
        list_data, extra_data = common.make_call('get_genres', call_args)

        finalize_directory(convert_list(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')
Esempio n. 13
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(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')
Esempio n. 14
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(list_data), g.CONTENT_IMAGES)
     end_of_directory(False, False)