From 82f20cd11134085de9b142e1ebf69149cc39cce6 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 29 Apr 2021 14:08:53 -0400 Subject: [PATCH] fix for multiple IDs --- modules/config.py | 46 +++++++++++++++++++++++++--------------------- modules/tmdb.py | 3 ++- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/modules/config.py b/modules/config.py index da3409c2..fa468f2a 100644 --- a/modules/config.py +++ b/modules/config.py @@ -767,27 +767,31 @@ class Config: item_type = guid.scheme.split(".")[-1] check_id = guid.netloc - if item_type == "plex" and check_id == "movie": - try: - for guid_tag in self.get_guids(item): - url_parsed = requests.utils.urlparse(guid_tag.id) - if url_parsed.scheme == "tmdb": tmdb_id = int(url_parsed.netloc) - elif url_parsed.scheme == "imdb": imdb_id = url_parsed.netloc - except requests.exceptions.ConnectionError: - util.print_stacktrace() - logger.error(f"{'Cache | ! |' if self.Cache else 'Mapping Error:'} {item.guid:<46} | No External GUIDs found for {item.title}") - return None, None - elif item_type == "plex" and check_id == "show": - try: - for guid_tag in self.get_guids(item): - url_parsed = requests.utils.urlparse(guid_tag.id) - if url_parsed.scheme == "tvdb": tvdb_id = int(url_parsed.netloc) - elif url_parsed.scheme == "imdb": imdb_id = url_parsed.netloc - elif url_parsed.scheme == "tmdb": tmdb_id = int(url_parsed.netloc) - except requests.exceptions.ConnectionError: - util.print_stacktrace() - logger.error(f"{'Cache | ! |' if self.Cache else 'Mapping Error:'} {item.guid:<46} | No External GUIDs found for {item.title}") - return None, None + if item_type == "plex": + tmdb_id = [] + imdb_id = [] + tvdb_id = [] + if check_id == "movie": + try: + for guid_tag in self.get_guids(item): + url_parsed = requests.utils.urlparse(guid_tag.id) + if url_parsed.scheme == "tmdb": tmdb_id.append(int(url_parsed.netloc)) + elif url_parsed.scheme == "imdb": imdb_id.append(url_parsed.netloc) + except requests.exceptions.ConnectionError: + util.print_stacktrace() + logger.error(f"{'Cache | ! |' if self.Cache else 'Mapping Error:'} {item.guid:<46} | No External GUIDs found for {item.title}") + return None, None + elif check_id == "show": + try: + for guid_tag in self.get_guids(item): + url_parsed = requests.utils.urlparse(guid_tag.id) + if url_parsed.scheme == "tvdb": tvdb_id.append(int(url_parsed.netloc)) + elif url_parsed.scheme == "imdb": imdb_id.append(url_parsed.netloc) + elif url_parsed.scheme == "tmdb": tmdb_id.append(int(url_parsed.netloc)) + except requests.exceptions.ConnectionError: + util.print_stacktrace() + logger.error(f"{'Cache | ! |' if self.Cache else 'Mapping Error:'} {item.guid:<46} | No External GUIDs found for {item.title}") + return None, None elif item_type == "imdb": imdb_id = check_id elif item_type == "thetvdb": tvdb_id = int(check_id) elif item_type == "themoviedb": tmdb_id = int(check_id) diff --git a/modules/tmdb.py b/modules/tmdb.py index 4df51913..50a03220 100644 --- a/modules/tmdb.py +++ b/modules/tmdb.py @@ -271,7 +271,8 @@ class TMDbAPI: try: ids.append(tmdb_item.id if is_movie else self.convert_tmdb_to_tvdb(tmdb_item.id)) count += 1 - except Failed: + except Failed as e: + logger.error(e) pass if count == amount: break if count == amount: break