def get_tvdb_id_from_name(name, lang): tools.show_busy() search_results = TVDB.search(name, language=lang) if not search_results: tools.hide_busy() plugin.ok( 'TV show not found', 'no show information found for %s in tvdb' % text.to_utf8(name)) items = [] for show in search_results: if show['seriesname'] == name: if 'firstaired' in show: show['year'] = int(show['firstaired'].split('-')[0].strip()) else: show['year'] = 'unknown' items.append(show) if len(items) > 1: selection = plugin.select('Choose TV Show', [ '%s (%s)' % (text.to_utf8(s['seriesname']), s['year']) for s in items ]) else: selection = 0 tools.hide_busy() if selection != -1: return items[selection]['id']
def tvdb_tv_search_term(term, page): search_results = TVDB.search(term, language='en') items = [] load_full_tvshow = lambda tvshow : TVDB.get_show(tvshow['id'], full=True) for tvdb_show in executor.execute(load_full_tvshow, search_results, workers=10): info = build_tvshow_info(tvdb_show) items.append(make_tvshow_item(info)) return items
def tmdb_to_tvdb(tmdb_show): from resources.lib.TheMovieDB import TV tvdb_show = None name = tmdb_show['original_name'] try: year = int(text.parse_year(tmdb_show['first_air_date'])) except: year = '' results = [x['id'] for x in TVDB.search(name, year)] if len(results) != 1: id = TV(tmdb_show['id']).external_ids().get('tvdb_id', None) if id: results = [id] if results: tvdb_show = TVDB[results[0]] return tvdb_show, tmdb_show