fix for multiple IDs

This commit is contained in:
meisnate12 2021-04-29 14:08:53 -04:00
parent b00e9dceaf
commit 82f20cd111
2 changed files with 27 additions and 22 deletions

View file

@ -767,27 +767,31 @@ class Config:
item_type = guid.scheme.split(".")[-1] item_type = guid.scheme.split(".")[-1]
check_id = guid.netloc check_id = guid.netloc
if item_type == "plex" and check_id == "movie": if item_type == "plex":
try: tmdb_id = []
for guid_tag in self.get_guids(item): imdb_id = []
url_parsed = requests.utils.urlparse(guid_tag.id) tvdb_id = []
if url_parsed.scheme == "tmdb": tmdb_id = int(url_parsed.netloc) if check_id == "movie":
elif url_parsed.scheme == "imdb": imdb_id = url_parsed.netloc try:
except requests.exceptions.ConnectionError: for guid_tag in self.get_guids(item):
util.print_stacktrace() url_parsed = requests.utils.urlparse(guid_tag.id)
logger.error(f"{'Cache | ! |' if self.Cache else 'Mapping Error:'} {item.guid:<46} | No External GUIDs found for {item.title}") if url_parsed.scheme == "tmdb": tmdb_id.append(int(url_parsed.netloc))
return None, None elif url_parsed.scheme == "imdb": imdb_id.append(url_parsed.netloc)
elif item_type == "plex" and check_id == "show": except requests.exceptions.ConnectionError:
try: util.print_stacktrace()
for guid_tag in self.get_guids(item): logger.error(f"{'Cache | ! |' if self.Cache else 'Mapping Error:'} {item.guid:<46} | No External GUIDs found for {item.title}")
url_parsed = requests.utils.urlparse(guid_tag.id) return None, None
if url_parsed.scheme == "tvdb": tvdb_id = int(url_parsed.netloc) elif check_id == "show":
elif url_parsed.scheme == "imdb": imdb_id = url_parsed.netloc try:
elif url_parsed.scheme == "tmdb": tmdb_id = int(url_parsed.netloc) for guid_tag in self.get_guids(item):
except requests.exceptions.ConnectionError: url_parsed = requests.utils.urlparse(guid_tag.id)
util.print_stacktrace() if url_parsed.scheme == "tvdb": tvdb_id.append(int(url_parsed.netloc))
logger.error(f"{'Cache | ! |' if self.Cache else 'Mapping Error:'} {item.guid:<46} | No External GUIDs found for {item.title}") elif url_parsed.scheme == "imdb": imdb_id.append(url_parsed.netloc)
return None, None 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 == "imdb": imdb_id = check_id
elif item_type == "thetvdb": tvdb_id = int(check_id) elif item_type == "thetvdb": tvdb_id = int(check_id)
elif item_type == "themoviedb": tmdb_id = int(check_id) elif item_type == "themoviedb": tmdb_id = int(check_id)

View file

@ -271,7 +271,8 @@ class TMDbAPI:
try: try:
ids.append(tmdb_item.id if is_movie else self.convert_tmdb_to_tvdb(tmdb_item.id)) ids.append(tmdb_item.id if is_movie else self.convert_tmdb_to_tvdb(tmdb_item.id))
count += 1 count += 1
except Failed: except Failed as e:
logger.error(e)
pass pass
if count == amount: break if count == amount: break
if count == amount: break if count == amount: break