def list_episodes_tvdb(id, season_num): id = int(id) season_num = int(season_num) show = TVDB[id] show_info = meta_info.get_tvshow_metadata_tvdb(show, banners=False) season = show[season_num] season_info = meta_info.get_season_metadata_tvdb(show_info, season, banners=True) items = [] for (episode_num, episode) in season.items(): if not season_num == 0 and not episode.has_aired(flexible=False): break episode_info = meta_info.get_episode_metadata_tvdb(season_info, episode) context_menu = [] properties = {} try: if traktenabled and countenabled: playdata = get_show_play_count(Trakt.find_trakt_ids('tvdb', show_info['tvdb_id'], 'show')['trakt']) season_index = nav_base.get_play_count_info(playdata, season_num) properties = { 'TotalSeasons': len(playdata['seasons']), 'TotalEpisodes': playdata['seasons'][season_index]['aired'], # 'WatchedEpisodes': playdata['seasons'][season_index]['completed'], # 'UnWatchedEpisodes': playdata['seasons'][season_index]['aired'] - playdata['seasons'][season_index]['completed'] } episode_info.update({'playcount': nav_base.get_play_count_info(playdata, season_num, episode_num)}) except: pass episodeitem = { 'label': episode_info['title'], 'path': plugin.url_for('tv_play', id=id, season=season_num, episode=episode_num, usedefault=True), 'context_menu': context_menu, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'stream_info': {'video': {}}, 'properties': properties, 'thumbnail': episode_info['poster'], 'poster': season_info['poster'], 'fanart': episode_info['fanart'] } if enablefanart: try: art = get_fanarttv_art(show_info['tvdb_id'], query='episode', season=season_num) art = checkart(art) episodeitem.update(art) except: pass items.append(episodeitem) return items
def list_episodes_tvdb(id, season_num): id = int(id) season_num = int(season_num) show = TVDB[id] show_info = meta_info.get_tvshow_metadata_tvdb(show, banners=False) season = show[season_num] season_info = meta_info.get_season_metadata_tvdb(show_info, season, banners=True) items = [] for (episode_num, episode) in season.items(): if not season_num == 0 and not episode.has_aired(flexible=False): break episode_info = meta_info.get_episode_metadata_tvdb( season_info, episode) if xbmc.getCondVisibility('system.hasaddon(script.extendedinfo)'): context_menu = [( 'OpenInfo', 'RunScript(script.extendedinfo,info=extendedepisodeinfo,tvshow=%s,season=%s,episode=%s)' % (show_info['name'], season_num, episode_num))] else: context_menu = [] items.append({ 'label': episode_info['title'], 'path': plugin.url_for('tv_play', id=id, season=season_num, episode=episode_num), 'context_menu': context_menu, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'stream_info': { 'video': {} }, 'thumbnail': episode_info['poster'], 'poster': season_info['poster'], 'fanart': episode_info['fanart'] }) return items
def play_episode(id, season, episode): from resources.lib.TheTVDB import TVDB id = int(id) season = int(season) episode = int(episode) dbid = xbmc.getInfoLabel('ListItem.DBID') try: dbid = int(dbid) except: dbid = None show = TVDB[id] show_info = meta_info.get_tvshow_metadata_tvdb(show, banners=False) play_plugin = meta_players.ADDON_SELECTOR.id PLAYERS = meta_players.get_players('tvshows') players = [p for p in PLAYERS if p.id == play_plugin] or PLAYERS if not players or len(players) == 0: xbmc.executebuiltin('Action(Info)') play_base.action_cancel() return trakt_ids = play_base.get_trakt_ids('tvdb', id, show['seriesname'], 'show', show.get('year', 0)) params = {} for lang in meta_players.get_needed_langs(players): tvdb_data = show if tvdb_data['seriesname'] is None: continue episode_parameters = get_episode_parameters(tvdb_data, season, episode) if episode_parameters is not None: params[lang] = episode_parameters else: if trakt_ids['tmdb'] != None and trakt_ids['tmdb'] != '': return tmdb_play_episode(trakt_ids['tmdb'], season, episode) elif trakt_ids['tvdb'] == None or trakt_ids['tvdb'] == '': plugin.ok('Information not found for:', '%s - S%sE%s' % (show_info['name'], season, episode)) else: plugin.ok('Information not found for:', '%s - S%sE%s' % (show_info['name'], season, episode)) if trakt_ids != None: params[lang].update(trakt_ids) params[lang]['info'] = show_info params[lang] = text.to_unicode(params[lang]) link = play_base.on_play_video(players, params, trakt_ids) if link: plugin.setProperty('plugin.video.openmeta.data', json.dumps( { 'dbid': dbid, 'tvdb': id, 'season': season, 'episode': episode })) season_info = meta_info.get_season_metadata_tvdb(show_info, show[season], banners=False) episode_info = meta_info.get_episode_metadata_tvdb(season_info, show[season][episode]) play_base.action_play( { 'label': episode_info['name'], 'path': link, 'info': episode_info, 'is_playable': True, 'info_type': 'video', 'thumbnail': episode_info['poster'], 'poster': episode_info['poster'], 'fanart': episode_info['fanart'] })