fix for sonarr/radarr

pull/494/head
meisnate12 3 years ago
parent bbf35d8f44
commit 495b730b30

@ -1945,9 +1945,13 @@ class CollectionBuilder:
self.library.edit_tags("label", item, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags) self.library.edit_tags("label", item, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags)
path = os.path.dirname(str(item.locations[0])) if self.library.is_movie else str(item.locations[0]) path = os.path.dirname(str(item.locations[0])) if self.library.is_movie else str(item.locations[0])
if self.library.Radarr and item.ratingKey in self.library.movie_rating_key_map: if self.library.Radarr and item.ratingKey in self.library.movie_rating_key_map:
tmdb_paths.append((self.library.movie_rating_key_map[item.ratingKey], f"{path.replace(self.library.Radarr.plex_path, self.library.Radarr.radarr_path)}/")) path = path.replace(self.library.Radarr.plex_path, self.library.Radarr.radarr_path)
path = path[:-1] if path.endswith(('/', '\\')) else path
tmdb_paths.append((self.library.movie_rating_key_map[item.ratingKey], path))
if self.library.Sonarr and item.ratingKey in self.library.show_rating_key_map: if self.library.Sonarr and item.ratingKey in self.library.show_rating_key_map:
tvdb_paths.append((self.library.show_rating_key_map[item.ratingKey], f"{path.replace(self.library.Sonarr.plex_path, self.library.Sonarr.sonarr_path)}/")) path = path.replace(self.library.Sonarr.plex_path, self.library.Sonarr.sonarr_path)
path = path[:-1] if path.endswith(('/', '\\')) else path
tvdb_paths.append((self.library.show_rating_key_map[item.ratingKey], path))
advance_edits = {} advance_edits = {}
for method_name, method_data in self.item_details.items(): for method_name, method_data in self.item_details.items():
if method_name in plex.item_advance_keys: if method_name in plex.item_advance_keys:

@ -58,8 +58,10 @@ class Radarr:
arr_ids = {} arr_ids = {}
for movie in self.api.all_movies(): for movie in self.api.all_movies():
if movie.path: if movie.path:
arr_paths[movie.path] = movie.tmdbId arr_paths[movie.path[:-1] if movie.path.endswith(("/", "\\")) else movie.path] = movie.tmdbId
arr_ids[movie.tmdbId] = movie arr_ids[movie.tmdbId] = movie
logger.debug(arr_paths)
logger.debug(arr_ids)
added = [] added = []
exists = [] exists = []

@ -84,8 +84,10 @@ class Sonarr:
arr_ids = {} arr_ids = {}
for series in self.api.all_series(): for series in self.api.all_series():
if series.path: if series.path:
arr_paths[series.path] = series.tvdbId arr_paths[series.path[:-1] if series.path.endswith(("/", "\\")) else series.path] = series.tvdbId
arr_paths[series.tvdbId] = series arr_paths[series.tvdbId] = series
logger.debug(arr_paths)
logger.debug(arr_ids)
added = [] added = []
exists = [] exists = []

@ -410,9 +410,13 @@ def library_operations(config, library):
path = os.path.dirname(str(item.locations[0])) if library.is_movie else str(item.locations[0]) path = os.path.dirname(str(item.locations[0])) if library.is_movie else str(item.locations[0])
if library.Radarr and library.radarr_add_all and tmdb_id: if library.Radarr and library.radarr_add_all and tmdb_id:
radarr_adds.append((tmdb_id, f"{path.replace(library.Radarr.plex_path, library.Radarr.radarr_path)}/")) path = path.replace(library.Radarr.plex_path, library.Radarr.radarr_path)
path = path[:-1] if path.endswith(('/', '\\')) else path
radarr_adds.append((tmdb_id, path))
if library.Sonarr and library.sonarr_add_all and tvdb_id: if library.Sonarr and library.sonarr_add_all and tvdb_id:
sonarr_adds.append((tvdb_id, f"{path.replace(library.Sonarr.plex_path, library.Sonarr.sonarr_path)}/")) path = path.replace(library.Sonarr.plex_path, library.Sonarr.sonarr_path)
path = path[:-1] if path.endswith(('/', '\\')) else path
sonarr_adds.append((tvdb_id, path))
tmdb_item = None tmdb_item = None
if library.tmdb_collections or library.mass_genre_update == "tmdb" or library.mass_audience_rating_update == "tmdb" or library.mass_critic_rating_update == "tmdb": if library.tmdb_collections or library.mass_genre_update == "tmdb" or library.mass_audience_rating_update == "tmdb" or library.mass_critic_rating_update == "tmdb":

Loading…
Cancel
Save