Skip to content

Commit

Permalink
fix for #28
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Feb 16, 2021
1 parent 75eed39 commit 629d8b1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ def update_libraries(self, test):
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
Expand Down Expand Up @@ -1184,13 +1186,13 @@ def get_id(self, item, library, length):
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
Expand Down
2 changes: 1 addition & 1 deletion modules/mal.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def convert_tmdb_to_mal(self, tmdb_id): return self.convert_mal(tmdb
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):
Expand Down
2 changes: 1 addition & 1 deletion modules/tmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def convert_from_tmdb(self, tmdb_id, convert_to, is_movie):
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)
Expand Down
2 changes: 1 addition & 1 deletion modules/trakt.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def convert_id(self, external_id, from_source, to_source, media_type):
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))

Expand Down

0 comments on commit 629d8b1

Please sign in to comment.