def make_items(self): self.poster_main, self.poster_backup, self.fanart_main, self.fanart_backup = get_art_provider( ) self.title = self.meta['title'] self.year = str(self.meta['year']) self.poster = self.meta.get(self.poster_main) or self.meta.get( self.poster_backup) or backup_poster self.fanart = self.meta.get(self.fanart_main) or self.meta.get( self.fanart_backup) or '' self.clearlogo = self.meta['clearlogo']
def set_properties(self): self.poster_main, self.poster_backup, self.fanart_main, self.fanart_backup = get_art_provider() self.setProperty('tikiskins.title', self.meta['title']) self.setProperty('tikiskins.poster', self.original_poster()) self.setProperty('tikiskins.fanart', self.original_fanart()) self.setProperty('tikiskins.nextep_function', self.function) if self.function == 'next_ep': self.setProperty('tikiskins.next_episode', '[B]%s - %02dx%02d[/B] - %s' % (self.meta['title'], self.meta['season'], self.meta['episode'], self.meta['ep_name'])) else: self.setProperty('tikiskins.title', self.meta['title'])
def set_properties(self): self.poster_main, self.poster_backup, self.fanart_main, self.fanart_backup = get_art_provider( ) self.setProperty('tikiskins.window_style', self.window_style) self.setProperty('tikiskins.fanart', self.original_fanart()) self.setProperty('tikiskins.poster', self.original_poster()) self.setProperty('tikiskins.clearlogo', self.meta['clearlogo']) self.setProperty('tikiskins.plot', self.meta['plot']) self.setProperty('tikiskins.total_results', self.total_results) self.setProperty('tikiskins.filters_ignored', self.filters_ignored)
def worker(self): if self.is_widget == 'unchecked': self.is_widget = kodi_utils.external_browse() if not self.exit_list_params: self.exit_list_params = kodi_utils.get_infolabel( 'Container.FolderPath') self.get_info() self.watched_title = 'Trakt' if self.watched_indicators == 1 else 'Fen' self.poster_main, self.poster_backup, self.fanart_main, self.fanart_backup = settings.get_art_provider( ) self.append = self.items.append threads = list( make_thread_list_enumerate(self.build_movie_content, self.list, Thread)) [i.join() for i in threads] self.items.sort(key=lambda k: int(k[1].getProperty('fen_sort_order'))) return self.items
def downPrep(self): if 'meta' in self.params: art_provider = get_art_provider() self.meta = json.loads(self.params_get('meta')) self.meta_get = self.meta.get title = get_title(self.meta) self.db_type = self.meta_get('vid_type') self.year = self.meta_get('year') self.image = self.meta_get('poster') self.image = self.meta_get(art_provider[0]) or self.meta_get( art_provider[1]) or poster_empty self.season = self.meta_get('season') self.name = self.params_get('name') else: self.meta = None title = self.params_get('name') self.db_type = self.params_get('db_type') self.image = self.params_get('image') self.name = None self.title = clean_file_name(title) self.provider = self.params_get('provider') self.action = self.params_get('action') self.source = self.params_get('source') self.final_name = None
def build_season_list(params): def _process(): running_ep_count = total_aired_eps def _unaired_status(): if episode_count == 0: return True season_date_start = adjust_premiered_date(air_date, 0)[0] if not season_date_start or current_date < season_date_start: return True return False for item in season_data: try: listitem = make_listitem() set_property = listitem.setProperty cm = [] cm_append = cm.append item_get = item.get overview = item_get('overview') name = item_get('name') poster_path = item_get('poster_path') air_date = item_get('air_date') season_number = item_get('season_number') episode_count = item_get('episode_count') season_poster = 'https://image.tmdb.org/t/p/%s%s' % ( image_resolution, poster_path) if poster_path is not None else show_poster if season_number == 0: unaired = False else: unaired = _unaired_status() if unaired: if not show_unaired: return episode_count = 0 else: running_ep_count -= episode_count if running_ep_count < 0: episode_count = running_ep_count + episode_count try: year = air_date.split('-')[0] except: year = show_year plot = overview if overview != '' else show_plot title = name if use_season_title and name != '' else '%s %s' % ( season_str, string(season_number)) if unaired: title = unaired_label % title playcount, overlay, watched, unwatched = get_watched_status_season( watched_info, string(tmdb_id), season_number, episode_count) url_params = build_url({ 'mode': 'build_episode_list', 'tmdb_id': tmdb_id, 'season': season_number }) extras_params = build_url({ 'mode': 'extras_menu_choice', 'tmdb_id': tmdb_id, 'db_type': 'tvshow', 'is_widget': is_widget }) options_params = build_url({ 'mode': 'options_menu_choice', 'content': 'season', 'tmdb_id': tmdb_id }) cm_append((extras_str, run_plugin % extras_params)) cm_append((options_str, run_plugin % options_params)) if not playcount: watched_params = build_url({ 'mode': 'mark_as_watched_unwatched_season', 'action': 'mark_as_watched', 'title': show_title, 'year': show_year, 'tmdb_id': tmdb_id, 'tvdb_id': tvdb_id, 'season': season_number }) cm_append((watched_str % watched_title, run_plugin % watched_params)) if watched: unwatched_params = build_url({ 'mode': 'mark_as_watched_unwatched_season', 'action': 'mark_as_unwatched', 'title': show_title, 'year': show_year, 'tmdb_id': tmdb_id, 'tvdb_id': tvdb_id, 'season': season_number }) cm_append((unwatched_str % watched_title, run_plugin % unwatched_params)) listitem.setLabel(title) listitem.setContentLookup(False) listitem.addContextMenuItems(cm) listitem.setArt({ 'poster': season_poster, 'icon': season_poster, 'thumb': season_poster, 'fanart': fanart, 'banner': banner, 'clearart': clearart, 'clearlogo': clearlogo, 'landscape': landscape, 'tvshow.clearart': clearart, 'tvshow.clearlogo': clearlogo, 'tvshow.landscape': landscape, 'tvshow.banner': banner }) listitem.setCast(cast) listitem.setUniqueIDs({ 'imdb': imdb_id, 'tmdb': string(tmdb_id), 'tvdb': string(tvdb_id) }) listitem.setInfo( 'video', { 'mediatype': 'season', 'trailer': trailer, 'title': title, 'size': '0', 'duration': episode_run_time, 'plot': plot, 'rating': rating, 'premiered': premiered, 'studio': studio, 'year': year, 'genre': genre, 'mpaa': mpaa, 'tvshowtitle': show_title, 'imdbnumber': imdb_id, 'votes': votes, 'season': season_number, 'playcount': playcount, 'overlay': overlay }) set_property('watchedepisodes', string(watched)) set_property('unwatchedepisodes', string(unwatched)) set_property('totalepisodes', string(episode_count)) if is_widget: set_property('fen_widget', 'true') set_property('fen_playcount', string(playcount)) set_property('fen_extras_menu_params', extras_params) set_property('fen_options_menu_params', options_params) else: set_property('fen_widget', 'false') yield (url_params, listitem, True) except: pass __handle__ = int(argv[1]) meta_user_info = metadata.retrieve_user_info() watched_indicators = settings.watched_indicators() watched_info = get_watched_info_tv(watched_indicators) show_unaired = settings.show_unaired() is_widget = kodi_utils.external_browse() current_date = get_datetime() image_resolution = meta_user_info['image_resolution']['poster'] poster_main, poster_backup, fanart_main, fanart_backup = settings.get_art_provider( ) meta = metadata.tvshow_meta('tmdb_id', params['tmdb_id'], meta_user_info) meta_get = meta.get season_data = meta_get('season_data') if not season_data: return tmdb_id, tvdb_id, imdb_id = meta_get('tmdb_id'), meta_get( 'tvdb_id'), meta_get('imdb_id') show_title, show_year, show_plot, banner = meta_get('title'), meta_get( 'year'), meta_get('plot'), meta_get('banner') show_poster = meta_get(poster_main) or meta_get( poster_backup) or poster_empty fanart = meta_get(fanart_main) or meta_get(fanart_backup) or fanart_empty clearlogo, clearart, landscape = meta_get('clearlogo'), meta_get( 'clearart'), meta_get('landscape') cast, mpaa, votes = meta_get('cast'), meta_get('mpaa'), meta_get('votes') trailer, genre, studio = string( meta_get('trailer')), meta_get('genre'), meta_get('studio') episode_run_time, rating, premiered = meta_get( 'episode_run_time'), meta_get('rating'), meta_get('premiered') total_seasons = meta_get('total_seasons') total_aired_eps = meta_get('total_aired_eps') if not settings.show_specials(): season_data = [i for i in season_data if not i['season_number'] == 0] season_data.sort(key=lambda k: k['season_number']) use_season_title = settings.use_season_title() watched_title = 'Trakt' if watched_indicators == 1 else 'Fen' kodi_utils.add_items(__handle__, list(_process())) kodi_utils.set_content(__handle__, 'seasons') kodi_utils.end_directory(__handle__) kodi_utils.set_view_mode('view.seasons', 'seasons')
def get_single_episode_info(): display_title = settings.single_ep_display_title() date_format = settings.single_ep_format() art_keys = settings.get_art_provider() all_episodes = settings.default_all_episodes() return display_title, date_format, art_keys, all_episodes
def build_episode_list(params): def _process(): for item in episodes_data: try: cm = [] listitem = make_listitem() set_property = listitem.setProperty cm_append = cm.append item_get = item.get season = item_get('season') episode = item_get('episode') ep_name = item_get('title') premiered = item_get('premiered') all_cast = cast + item_get('guest_stars', []) episode_date, premiered = adjust_premiered_date(premiered, adjust_hours) playcount, overlay = get_watched_status(watched_info, string(tmdb_id), season, episode) resumetime = get_resumetime(bookmarks, tmdb_id, season, episode) thumb = item_get('thumb', None) or fanart if thumb_fanart: background = thumb else: background = fanart item.update({'trailer': trailer, 'tvshowtitle': title, 'premiered': premiered, 'genre': genre, 'duration': duration, 'mpaa': mpaa, 'studio': studio, 'playcount': playcount, 'overlay': overlay}) extras_params = build_url({'mode': 'extras_menu_choice', 'tmdb_id': tmdb_id, 'db_type': 'tvshow', 'is_widget': is_widget}) options_params = build_url({'mode': 'options_menu_choice', 'content': 'episode', 'tmdb_id': tmdb_id, 'season': season, 'episode': episode}) url_params = build_url({'mode': 'play_media', 'vid_type': 'episode', 'tmdb_id': tmdb_id, 'season': season, 'episode': episode}) display = ep_name unaired = False if not episode_date or current_date < episode_date: if not show_unaired: continue if season != 0: unaired = True display = unaired_label % ep_name item['title'] = display cm_append((extras_str, run_plugin % extras_params)) cm_append((options_str, run_plugin % options_params)) clearprog_params, unwatched_params, watched_params = '', '', '' if not unaired: if resumetime != '0': clearprog_params = build_url({'mode': 'watched_unwatched_erase_bookmark', 'db_type': 'episode', 'tmdb_id': tmdb_id, 'season': season, 'episode': episode, 'refresh': 'true'}) cm_append((clearprog_str, run_plugin % clearprog_params)) set_property('fen_in_progress', 'true') if playcount: unwatched_params = build_url({'mode': 'mark_as_watched_unwatched_episode', 'action': 'mark_as_unwatched', 'tmdb_id': tmdb_id, 'tvdb_id': tvdb_id, 'season': season, 'episode': episode, 'title': title, 'year': year}) cm_append((unwatched_str % watched_title, run_plugin % unwatched_params)) else: watched_params = build_url({'mode': 'mark_as_watched_unwatched_episode', 'action': 'mark_as_watched', 'tmdb_id': tmdb_id, 'tvdb_id': tvdb_id, 'season': season, 'episode': episode, 'title': title, 'year': year}) cm_append((watched_str % watched_title, run_plugin % watched_params)) listitem.setLabel(display) listitem.setContentLookup(False) listitem.addContextMenuItems(cm) listitem.setArt({'poster': show_poster, 'fanart': background, 'thumb': thumb, 'icon':thumb, 'banner': banner, 'clearart': clearart, 'clearlogo': clearlogo, 'landscape': thumb, 'tvshow.clearart': clearart, 'tvshow.clearlogo': clearlogo, 'tvshow.landscape': thumb, 'tvshow.banner': banner}) listitem.setCast(all_cast) listitem.setUniqueIDs({'imdb': imdb_id, 'tmdb': string(tmdb_id), 'tvdb': string(tvdb_id)}) listitem.setInfo('video', remove_meta_keys(item, dict_removals)) set_property('resumetime', resumetime) if is_widget: set_property('fen_widget', 'true') set_property('fen_playcount', string(playcount)) set_property('fen_options_menu_params', options_params) set_property('fen_extras_menu_params', extras_params) set_property('fen_unwatched_params', unwatched_params) set_property('fen_watched_params', watched_params) set_property('fen_clearprog_params', clearprog_params) else: set_property('fen_widget', 'false') yield (url_params, listitem, False) except: pass __handle__ = int(argv[1]) item_list = [] append = item_list.append meta_user_info, watched_indicators, watched_info, show_unaired, thumb_fanart, is_widget, current_date, adjust_hours, bookmarks = get_episode_info() poster_main, poster_backup, fanart_main, fanart_backup = settings.get_art_provider() all_episodes = True if params.get('season') == 'all' else False meta = metadata.tvshow_meta('tmdb_id', params.get('tmdb_id'), meta_user_info) meta_get = meta.get tmdb_id, tvdb_id, imdb_id = meta_get('tmdb_id'), meta_get('tvdb_id'), meta_get('imdb_id') title, year, rootname, banner = meta_get('title'), meta_get('year'), meta_get('rootname'), meta_get('banner') show_poster = meta_get(poster_main) or meta_get(poster_backup) or poster_empty fanart = meta_get(fanart_main) or meta_get(fanart_backup) or fanart_empty clearlogo, clearart, landscape = meta_get('clearlogo'), meta_get('clearart'), meta_get('landscape') cast, mpaa, duration = meta_get('cast'), meta_get('mpaa'), meta_get('duration') trailer, genre, studio = string(meta_get('trailer')), meta_get('genre'), meta_get('studio') tvshow_plot = meta_get('plot') get_resumetime = indicators.get_resumetime get_watched_status = indicators.get_watched_status_episode watched_title = 'Trakt' if watched_indicators == 1 else 'Fen' if all_episodes: episodes_data = metadata.all_episodes_meta(meta, meta_user_info) if not settings.show_specials(): episodes_data = [i for i in episodes_data if not i['season'] == 0] else: episodes_data = metadata.season_episodes_meta(params['season'], meta, meta_user_info) kodi_utils.add_items(__handle__, list(_process())) kodi_utils.set_content(__handle__, 'episodes') kodi_utils.set_sort_method(__handle__, 'episodes') kodi_utils.end_directory(__handle__) kodi_utils.set_view_mode('view.episodes', 'episodes')
def build_single_episode(list_type, data): def _sort_results(items): if list_type_starts_with('next_episode'): def func(function): if sort_key == 'fen_name': return title_key(function, ignore_articles) elif sort_key == 'fen_last_played': return jsondate_to_datetime(function, resformat) else: return function sort_key = nextep_settings['sort_key'] sort_direction = nextep_settings['sort_direction'] if nextep_settings['sort_airing_today_to_top']: airing_today = [i for i in items if date_difference(current_date, jsondate_to_datetime(i[1].getProperty('fen_first_aired'), '%Y-%m-%d').date(), 0)] airing_today = sorted(airing_today, key=lambda i: i[1].getProperty('fen_first_aired')) remainder = [i for i in items if not i in airing_today] remainder = sorted(remainder, key=lambda i: func(i[1].getProperty(sort_key)), reverse=sort_direction) unaired = [i for i in remainder if i[1].getProperty('fen_unaired') == 'true'] aired = [i for i in remainder if not i in unaired] remainder = aired + unaired items = airing_today + remainder else: items = sorted(items, key=lambda i: func(i[1].getProperty(sort_key)), reverse=sort_direction) unaired = [i for i in items if i[1].getProperty('fen_unaired') == 'true'] aired = [i for i in items if not i in unaired] items = aired + unaired else: items.sort(key=lambda k: int(k[1].getProperty('fen_sort_order'))) return items def _process(item_position, ep_data): try: cm = [] listitem = make_listitem() set_property = listitem.setProperty cm_append = cm.append ep_data_get = ep_data.get if list_type_starts_with('trakt_'): tmdb_id = get_trakt_tvshow_id(ep_data_get('ids')) else: tmdb_id = ep_data_get('tmdb_id') if not tmdb_id: return meta = metadata.tvshow_meta('tmdb_id', tmdb_id, meta_user_info) meta_get = meta.get tmdb_id, tvdb_id, imdb_id = meta_get('tmdb_id'), meta_get('tvdb_id'), meta_get('imdb_id') title, year, rootname, banner = meta_get('title'), meta_get('year'), meta_get('rootname'), meta_get('banner') show_poster = meta_get(poster_main) or meta_get(poster_backup) or poster_empty fanart = meta_get(fanart_main) or meta_get(fanart_backup) or fanart_empty clearlogo, clearart, landscape = meta_get('clearlogo'), meta_get('clearart'), meta_get('landscape') cast, mpaa, duration = meta_get('cast'), meta_get('mpaa'), meta_get('duration') trailer, genre, studio = string(meta_get('trailer')), meta_get('genre'), meta_get('studio') tvshow_plot = meta_get('plot') orig_season = ep_data_get('season') orig_episode = ep_data_get('episode') if list_type_starts_with('next_episode'): season_data = meta_get('season_data') curr_season_data = [i for i in season_data if i['season_number'] == orig_season][0] orig_season = orig_season if orig_episode < curr_season_data['episode_count'] else orig_season + 1 orig_episode = orig_episode + 1 if orig_episode < curr_season_data['episode_count'] else 1 episodes_data = metadata.season_episodes_meta(orig_season, meta, meta_user_info) try: item = [i for i in episodes_data if i['episode'] == orig_episode][0] except: return item_get = item.get season = item_get('season') episode = item_get('episode') ep_name = item_get('title') orig_premiered = item_get('premiered') all_cast = cast + item_get('guest_stars', []) episode_date, premiered = adjust_premiered_date(orig_premiered, adjust_hours) if not episode_date or current_date < episode_date: if list_type_starts_with('next_episode'): if not include_unaired: return if not date_difference(current_date, episode_date, 7): return elif not show_unaired: return unaired = True set_property('fen_unaired', 'true') else: unaired = False set_property('fen_unaired', 'false') playcount, overlay = get_watched_status(watched_info, string(tmdb_id), season, episode) resumetime = get_resumetime(bookmarks, tmdb_id, season, episode) if display_title == 0: title_string = '%s: ' % title else: title_string = '' if display_title in (0,1): seas_ep = '%dx%.2d - ' % (season, episode) else: seas_ep = '' if list_type_starts_with('next_episode'): unwatched = ep_data_get('unwatched', False) if episode_date: display_premiered = make_day(current_date, episode_date, date_format) else: display_premiered == 'UNKNOWN' airdate = '[[COLOR magenta]%s[/COLOR]] ' % display_premiered if include_airdate else '' highlight_color = unwatched_color if unwatched else unaired_color if unaired else '' italics_open, italics_close = ('[I]', '[/I]') if highlight_color else ('', '') if highlight_color: episode_info = '%s[COLOR %s]%s %s[/COLOR]%s' % (italics_open, highlight_color, seas_ep, ep_name, italics_close) else: episode_info = '%s%s%s%s' % (italics_open, seas_ep, ep_name, italics_close) display = '%s%s%s' % (airdate, upper(title_string), episode_info) elif list_type == 'trakt_calendar': if episode_date: display_premiered = make_day(current_date, episode_date, date_format) else: display_premiered == 'UNKNOWN' display = '[%s]%s%s%s' % (display_premiered, upper(title_string), seas_ep, item_get('title')) if unaired: displays = display.split(']') display = '[COLOR red]' + displays[0] + '][/COLOR]' + displays[1] else: color_tags = ('[COLOR red]', '[/COLOR]') if unaired else ('', '') display = '%s%s%s%s%s' % (upper(title_string), color_tags[0], seas_ep, ep_name, color_tags[1]) thumb = item_get('thumb', None) or fanart if thumb_fanart: background = thumb else: background = fanart item.update({'trailer': trailer, 'tvshowtitle': title, 'premiered': premiered, 'genre': genre, 'duration': duration, 'mpaa': mpaa, 'studio': studio, 'playcount': playcount, 'overlay': overlay, 'title': display}) extras_params = build_url({'mode': 'extras_menu_choice', 'tmdb_id': tmdb_id, 'db_type': 'tvshow', 'is_widget': is_widget}) options_params = build_url({'mode': 'options_menu_choice', 'content': 'episode', 'tmdb_id': tmdb_id, 'season': season, 'episode': episode}) url_params = build_url({'mode': 'play_media', 'vid_type': 'episode', 'tmdb_id': tmdb_id, 'season': season, 'episode': episode}) if show_all_episodes: if all_episodes == 1 and meta_get('total_seasons') > 1: browse_params = build_url({'mode': 'build_season_list', 'tmdb_id': tmdb_id}) else: browse_params = build_url({'mode': 'build_episode_list', 'tmdb_id': tmdb_id, 'season': 'all'}) else: browse_params = build_url({'mode': 'build_season_list', 'tmdb_id': tmdb_id}) cm_append((extras_str, run_plugin % extras_params)) cm_append((options_str, run_plugin % options_params)) cm_append((browse_str, container_update % browse_params)) clearprog_params, unwatched_params, watched_params = '', '', '' if not unaired: if resumetime != '0': clearprog_params = build_url({'mode': 'watched_unwatched_erase_bookmark', 'db_type': 'episode', 'tmdb_id': tmdb_id, 'season': season, 'episode': episode, 'refresh': 'true'}) cm_append((clearprog_str, run_plugin % clearprog_params)) set_property('fen_in_progress', 'true') if playcount: unwatched_params = build_url({'mode': 'mark_as_watched_unwatched_episode', 'action': 'mark_as_unwatched', 'tmdb_id': tmdb_id, 'tvdb_id': tvdb_id, 'season': season, 'episode': episode, 'title': title, 'year': year}) cm_append((unwatched_str % watched_title, run_plugin % unwatched_params)) else: watched_params = build_url({'mode': 'mark_as_watched_unwatched_episode', 'action': 'mark_as_watched', 'tmdb_id': tmdb_id, 'tvdb_id': tvdb_id, 'season': season, 'episode': episode, 'title': title, 'year': year}) cm_append((watched_str % watched_title, run_plugin % watched_params)) if list_type == 'next_episode_trakt': cm_append((ls(32599), container_update % build_url({'mode': 'build_next_episode_manager'}))) listitem.setLabel(display) listitem.setContentLookup(False) listitem.addContextMenuItems(cm) listitem.setArt({'poster': show_poster, 'fanart': background, 'thumb': thumb, 'icon':thumb, 'banner': banner, 'clearart': clearart, 'clearlogo': clearlogo, 'landscape': thumb, 'tvshow.clearart': clearart, 'tvshow.clearlogo': clearlogo, 'tvshow.landscape': thumb, 'tvshow.banner': banner}) listitem.setCast(all_cast) listitem.setUniqueIDs({'imdb': imdb_id, 'tmdb': string(tmdb_id), 'tvdb': string(tvdb_id)}) listitem.setInfo('video', remove_meta_keys(item, dict_removals)) set_property('resumetime', resumetime) set_property('fen_name', '%s - %.2dx%.2d' % (title, season, episode)) if list_type_starts_with('next_episode'): last_played = ep_data_get('last_played', resinsert) set_property('fen_last_played', last_played) set_property('fen_first_aired', premiered) else: set_property('fen_sort_order', string(item_position)) if is_widget: set_property('fen_widget', 'true') set_property('fen_playcount', string(playcount)) set_property('fen_browse_params', browse_params) set_property('fen_options_menu_params', options_params) set_property('fen_extras_menu_params', extras_params) set_property('fen_unwatched_params', unwatched_params) set_property('fen_watched_params', watched_params) set_property('fen_clearprog_params', clearprog_params) else: set_property('fen_widget', 'false') append((url_params, listitem, False)) except: pass __handle__ = int(argv[1]) item_list = [] append = item_list.append list_type_starts_with = list_type.startswith get_resumetime = indicators.get_resumetime get_watched_status = indicators.get_watched_status_episode meta_user_info, watched_indicators, watched_info, show_unaired, thumb_fanart, is_widget, current_date, adjust_hours, bookmarks = get_episode_info() display_title, date_format, art_keys, all_episodes = get_single_episode_info() show_all_episodes = all_episodes in (1, 2) poster_main, poster_backup, fanart_main, fanart_backup = settings.get_art_provider() ignore_articles = settings.ignore_articles() watched_title = 'Trakt' if watched_indicators == 1 else 'Fen' if list_type_starts_with('next_episode'): nextep_settings, nextep_display_settings = settings.nextep_content_settings(), settings.nextep_display_settings() unaired_color, unwatched_color = nextep_display_settings['unaired_color'], nextep_display_settings['unwatched_color'] include_airdate = nextep_display_settings['include_airdate'] include_unaired = nextep_settings['include_unaired'] if watched_indicators == 1: resformat, resinsert = '%Y-%m-%dT%H:%M:%S.%fZ', '2000-01-01T00:00:00.000Z' else: resformat, resinsert = '%Y-%m-%d %H:%M:%S', '2000-01-01 00:00:00' threads = list(make_thread_list_enumerate(_process, data, Thread)) [i.join() for i in threads] item_list = _sort_results(item_list) kodi_utils.add_items(__handle__, item_list) kodi_utils.set_content(__handle__, 'episodes') kodi_utils.end_directory(__handle__, cacheToDisc=False) kodi_utils.set_view_mode('view.episodes', 'episodes') if list_type == 'trakt_calendar' and settings.calendar_focus_today(): today = '[%s]' % ls(32849).upper() try: index = max([i for i, x in enumerate([i[1].getLabel() for i in item_list]) if today in x]) except: return kodi_utils.focus_index(index)