mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
fix for #28
This commit is contained in:
parent
75eed3968f
commit
629d8b15b9
4 changed files with 9 additions and 7 deletions
|
@ -440,6 +440,8 @@ class Config:
|
|||
util.seperator("Mapping {} Library".format(library.name))
|
||||
logger.info("")
|
||||
movie_map, show_map = self.map_guids(library)
|
||||
logger.info(movie_map)
|
||||
logger.info(show_map)
|
||||
for c in collections:
|
||||
if test and ("test" not in collections[c] or collections[c]["test"] is not True):
|
||||
continue
|
||||
|
@ -1184,13 +1186,13 @@ class Config:
|
|||
if item_type == "plex" and library.is_movie:
|
||||
for guid_tag in item.guids:
|
||||
url_parsed = requests.utils.urlparse(guid_tag.id)
|
||||
if url_parsed.scheme == "tmdb": tmdb_id = url_parsed.netloc
|
||||
if url_parsed.scheme == "tmdb": tmdb_id = int(url_parsed.netloc)
|
||||
elif url_parsed.scheme == "imdb": imdb_id = url_parsed.netloc
|
||||
elif item_type == "imdb": imdb_id = check_id
|
||||
elif item_type == "thetvdb": tvdb_id = check_id
|
||||
elif item_type == "themoviedb": tmdb_id = check_id
|
||||
elif item_type == "thetvdb": tvdb_id = int(check_id)
|
||||
elif item_type == "themoviedb": tmdb_id = int(check_id)
|
||||
elif item_type == "hama":
|
||||
if check_id.startswith("tvdb"): tvdb_id = re.search("-(.*)", check_id).group(1)
|
||||
if check_id.startswith("tvdb"): tvdb_id = int(re.search("-(.*)", check_id).group(1))
|
||||
elif check_id.startswith("anidb"): anidb_id = re.search("-(.*)", check_id).group(1)
|
||||
else: error_message = "Hama Agent ID: {} not supported".format(check_id)
|
||||
elif item_type == "myanimelist": mal_id = check_id
|
||||
|
|
|
@ -17,7 +17,7 @@ class MyAnimeListIDList:
|
|||
def convert_mal(self, input_id, from_id, to_id):
|
||||
for attrs in self.ids:
|
||||
if from_id in attrs and int(attrs[from_id]) == int(input_id) and to_id in attrs and int(attrs[to_id]) > 0:
|
||||
return attrs[to_id]
|
||||
return int(attrs[to_id])
|
||||
raise Failed("MyAnimeList Error: {} ID not found for {}: {}".format(util.pretty_ids[to_id], util.pretty_ids[from_id], input_id))
|
||||
|
||||
def find_mal_ids(self, mal_id):
|
||||
|
|
|
@ -38,7 +38,7 @@ class TMDbAPI:
|
|||
def convert_to_tmdb(self, external_id, external_source, is_movie):
|
||||
search_results = self.Movie.external(external_id=external_id, external_source=external_source)
|
||||
search = search_results["movie_results" if is_movie else "tv_results"]
|
||||
if len(search) == 1: return search[0]["id"]
|
||||
if len(search) == 1: return int(search[0]["id"])
|
||||
else: raise Failed("TMDb Error: No TMDb ID found for {} {}".format(external_source.upper().replace("B_", "b "), external_id))
|
||||
|
||||
def convert_tmdb_to_imdb(self, tmdb_id, is_movie=True): return self.convert_from_tmdb(tmdb_id, "imdb_id", is_movie)
|
||||
|
|
|
@ -89,7 +89,7 @@ class TraktAPI:
|
|||
lookup = Trakt["search"].lookup(external_id, from_source, media_type)
|
||||
if lookup:
|
||||
lookup = lookup[0] if isinstance(lookup, list) else lookup
|
||||
return lookup.get_key(to_source)
|
||||
return lookup.get_key(to_source) if to_source == "imdb" else int(lookup.get_key(to_source))
|
||||
else:
|
||||
raise Failed("No {} ID found for {} ID {}".format(to_source.upper().replace("B", "b"), from_source.upper().replace("B", "b"), external_id))
|
||||
|
||||
|
|
Loading…
Reference in a new issue