tmdb mapping fixes

pull/652/head
meisnate12 3 years ago
parent a80997bef8
commit 17ec7f150c

@ -76,10 +76,13 @@ class TMDb:
return check_id return check_id
def convert_tvdb_to(self, tvdb_id): def convert_tvdb_to(self, tvdb_id):
results = self.TMDb.find_by_id(tvdb_id=tvdb_id) try:
if not results.tv_results: results = self.TMDb.find_by_id(tvdb_id=tvdb_id)
raise Failed(f"TMDb Error: No TMDb ID found for TVDb ID {tvdb_id}") if results.tv_results:
return results.tv_results[0].id return results.tv_results[0].id
except NotFound:
pass
raise Failed(f"TMDb Error: No TMDb ID found for TVDb ID {tvdb_id}")
def convert_imdb_to(self, imdb_id): def convert_imdb_to(self, imdb_id):
try: try:
@ -91,10 +94,9 @@ class TMDb:
elif results.tv_episode_results: elif results.tv_episode_results:
item = results.tv_episode_results[0] item = results.tv_episode_results[0]
return f"{item.tv_id}_{item.season_number}_{item.episode_number}", "episode" return f"{item.tv_id}_{item.season_number}_{item.episode_number}", "episode"
else:
raise NotFound
except NotFound: except NotFound:
raise Failed(f"TMDb Error: No TMDb ID found for IMDb ID {imdb_id}") pass
raise Failed(f"TMDb Error: No TMDb ID found for IMDb ID {imdb_id}")
def get_movie_show_or_collection(self, tmdb_id, is_movie): def get_movie_show_or_collection(self, tmdb_id, is_movie):
if is_movie: if is_movie:

Loading…
Cancel
Save