def test_search_and_grab(self): tv = TVDB(lang='en', wait=0.2, search_and_grab=True) tv.search('x', onfinished=partial(process_series, tv)) tv.search('aria the animation', onfinished=partial(process_series, tv)) tv.search('nichijou', onfinished=partial(process_series, tv)) tv.search('legend of the galactic heroes', onfinished=partial(process_series, tv))
def list_tvshow(force_rescan=False): tvdb = TVDB("9ec9de2268745b801af7c5f21d2a16b8") tvshow_model = TVShowsModel(DB_NAME) tvshow_list = TVShowList(TVSHOW_PATH) for tvshow_name in tvshow_list: if tvshow_model.get_tvshow_by_name( tvshow_name) and force_rescan is False: continue tvshow_name_decoded = unidecode.unidecode(tvshow_name) print(tvshow_name_decoded) yield tvshow_name, tvdb.search_tv_shows(tvshow_name_decoded)
def test_backend_search(self): tv = TVDB(lang='en', backend='ddg', wait=0.1) tv.search('x', onfinished=partial(search_finished, 'x'), backend='no', episode_summary=True) tv.search('aria the animation', onfinished=search_finished, backend='no', episode_summary=True) tv.search('nichijou', onfinished=search_finished) tv.search('legend galactic heroes', onfinished=search_finished, backend='g')
def list_movie(): tvdb = TVDB("9ec9de2268745b801af7c5f21d2a16b8") for movie_name, movie_filename, extension, duration in MovieList( MOVIE_PATH): movie_propositions = tvdb.search_movies(movie_name) for movie_proposition in movie_propositions: movie_proposition.directors = tvdb.get_movie_directors_by_movie_id( movie_proposition.id) movie_proposition.cast = tvdb.get_movie_cast_by_movie_id( movie_proposition.id) movie_proposition.runtime = tvdb.get_movie_runtime_by_id( movie_proposition.id) yield movie_name, movie_filename, movie_propositions, extension, duration
def get_tvshow_episode_details(tvshow_id, episode_path): season, ep_number = None, None try: season, ep_number = re.search("S([0-9]{1,2})E([0-9]{1,2})", episode_path.name).groups() except AttributeError: pass try: season, ep_number = re.search("s([0-9]{1,2})e([0-9]{1,2})", episode_path.name).groups() except AttributeError: pass try: season, ep_number = re.search("([0-9]{1,2})x([0-9]{1,2})", episode_path.name).groups() except AttributeError: pass if not season and not ep_number: return {} return TVDB("9ec9de2268745b801af7c5f21d2a16b8", "en")\ .get_tvshow_episode_detail_by_id_and_episode_number(str(tvshow_id), season, ep_number)
def test_only_search(self): tv = TVDB(lang='en', wait=0.2, search_and_grab=False) tv.search('x', onfinished=search_finished) tv.search('aria the animation', onfinished=search_finished) tv.search('nichijou', onfinished=search_finished) tv.search('legend of the galactic heroes', onfinished=search_finished)