imdb convert fix

pull/652/head
meisnate12 3 years ago
parent 914082aea4
commit 677d2f312d

@ -1,7 +1,7 @@
import logging import logging
from modules import util from modules import util
from modules.util import Failed from modules.util import Failed
from tmdbapis import TMDbAPIs, TMDbException from tmdbapis import TMDbAPIs, TMDbException, NotFound
logger = logging.getLogger("Plex Meta Manager") logger = logging.getLogger("Plex Meta Manager")
@ -82,6 +82,7 @@ class TMDb:
return results.tv_results[0].id return results.tv_results[0].id
def convert_imdb_to(self, imdb_id): def convert_imdb_to(self, imdb_id):
try:
results = self.TMDb.find_by_id(imdb_id=imdb_id) results = self.TMDb.find_by_id(imdb_id=imdb_id)
if results.movie_results: if results.movie_results:
return results.movie_results[0].id, "movie" return results.movie_results[0].id, "movie"
@ -91,6 +92,8 @@ class TMDb:
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: else:
raise NotFound
except NotFound:
raise Failed(f"TMDb Error: No TMDb ID found for IMDb ID {imdb_id}") 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):

Loading…
Cancel
Save