def build_episode_listing(episodes_list, seasonid, pathitems=None): """Build a episodes listing of a season""" common_data = { 'params': get_param_watched_status_by_profile(), 'set_watched_status': g.ADDON.getSettingBool('ProgressManager_enabled'), 'supplemental_info_color': get_color_name(g.ADDON.getSettingInt('supplemental_info_color')), 'profile_language_code': g.LOCAL_DB.get_profile_config('language', '') } directory_items = [ _create_episode_item(seasonid, episodeid_value, episode, episodes_list, common_data) for episodeid_value, episode in iteritems(episodes_list.episodes) ] # add_items_previous_next_page use the new value of perpetual_range_selector add_items_previous_next_page(directory_items, pathitems, episodes_list.perpetual_range_selector) return directory_items, { 'title': episodes_list.tvshow['title'] + ' - ' + episodes_list.season['summary']['name'] }
def build_season_listing(season_list, tvshowid, pathitems=None): """Build a season listing""" common_data = { 'supplemental_info_color': get_color_name(g.ADDON.getSettingInt('supplemental_info_color')), 'profile_language_code': g.LOCAL_DB.get_profile_config('language', '') } directory_items = [_create_season_item(tvshowid, seasonid_value, season, season_list, common_data) for seasonid_value, season in iteritems(season_list.seasons)] # add_items_previous_next_page use the new value of perpetual_range_selector add_items_previous_next_page(directory_items, pathitems, season_list.perpetual_range_selector, tvshowid) return directory_items, {'title': season_list.tvshow['title'] + ' - ' + common.get_local_string(20366)[2:]}
def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None, perpetual_range_start=None, mylist_items=None): """Build a video listing""" common_data = { 'params': get_param_watched_status_by_profile(), 'mylist_items': mylist_items, 'set_watched_status': g.ADDON.getSettingBool('ProgressManager_enabled'), 'supplemental_info_color': get_color_name(g.ADDON.getSettingInt('supplemental_info_color')), 'mylist_titles_color': (get_color_name(g.ADDON.getSettingInt('mylist_titles_color')) if menu_data['path'][1] != 'myList' else None), 'profile_language_code': g.LOCAL_DB.get_profile_config('language', '') } directory_items = [_create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data) for videoid_value, video in iteritems(video_list.videos)] # If genre_id exists add possibility to browse LoLoMo sub-genres if sub_genre_id and sub_genre_id != 'None': # Create dynamic sub-menu info in MAIN_MENU_ITEMS menu_id = 'subgenre_' + sub_genre_id sub_menu_data = menu_data.copy() sub_menu_data['path'] = [menu_data['path'][0], menu_id, sub_genre_id] sub_menu_data['lolomo_known'] = False sub_menu_data['lolomo_contexts'] = None sub_menu_data['content_type'] = menu_data.get('content_type', g.CONTENT_SHOW) sub_menu_data.update({'title': common.get_local_string(30089)}) sub_menu_data['initial_menu_id'] = menu_data.get('initial_menu_id', menu_data['path'][1]) g.LOCAL_DB.set_value(menu_id, sub_menu_data, TABLE_MENU_DATA) # Create the folder for the access to sub-genre folder_dict_item = { 'url': common.build_url(['genres', menu_id, sub_genre_id], mode=g.MODE_DIRECTORY), 'title': common.get_local_string(30089), 'art': {'icon': 'DefaultVideoPlaylists.png'}, 'info': {'plot': common.get_local_string(30088)}, # The description 'is_folder': True } directory_items.insert(0, folder_dict_item) # add_items_previous_next_page use the new value of perpetual_range_selector add_items_previous_next_page(directory_items, pathitems, video_list.perpetual_range_selector, sub_genre_id) return directory_items, {}