|
|
@ -37,6 +37,7 @@ class Sonarr:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self.api = SonarrAPI(self.url, self.token, session=self.config.session)
|
|
|
|
self.api = SonarrAPI(self.url, self.token, session=self.config.session)
|
|
|
|
self.api.respect_list_exclusions_when_adding()
|
|
|
|
self.api.respect_list_exclusions_when_adding()
|
|
|
|
|
|
|
|
self.api._validate_add_options(params["root_folder_path"], params["quality_profile"], params["language_profile"])
|
|
|
|
except ArrException as e:
|
|
|
|
except ArrException as e:
|
|
|
|
raise Failed(e)
|
|
|
|
raise Failed(e)
|
|
|
|
self.add = params["add"]
|
|
|
|
self.add = params["add"]
|
|
|
@ -93,6 +94,7 @@ class Sonarr:
|
|
|
|
shows = []
|
|
|
|
shows = []
|
|
|
|
path_lookup = {}
|
|
|
|
path_lookup = {}
|
|
|
|
mismatched = {}
|
|
|
|
mismatched = {}
|
|
|
|
|
|
|
|
path_in_use = {}
|
|
|
|
for i, item in enumerate(tvdb_ids, 1):
|
|
|
|
for i, item in enumerate(tvdb_ids, 1):
|
|
|
|
path = item[1] if isinstance(item, tuple) else None
|
|
|
|
path = item[1] if isinstance(item, tuple) else None
|
|
|
|
tvdb_id = item[0] if isinstance(item, tuple) else item
|
|
|
|
tvdb_id = item[0] if isinstance(item, tuple) else item
|
|
|
@ -110,6 +112,9 @@ class Sonarr:
|
|
|
|
mismatched[path] = tvdb_id
|
|
|
|
mismatched[path] = tvdb_id
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
show = self.api.get_series(tvdb_id=tvdb_id)
|
|
|
|
show = self.api.get_series(tvdb_id=tvdb_id)
|
|
|
|
|
|
|
|
if f"{folder}/{show.folder}" in arr_paths:
|
|
|
|
|
|
|
|
path_in_use[f"{folder}/{show.folder}"] = tvdb_id
|
|
|
|
|
|
|
|
continue
|
|
|
|
if path:
|
|
|
|
if path:
|
|
|
|
shows.append((show, path))
|
|
|
|
shows.append((show, path))
|
|
|
|
path_lookup[path] = tvdb_id
|
|
|
|
path_lookup[path] = tvdb_id
|
|
|
@ -144,17 +149,24 @@ class Sonarr:
|
|
|
|
if self.config.Cache:
|
|
|
|
if self.config.Cache:
|
|
|
|
self.config.Cache.update_sonarr_adds(series.tvdbId, self.library.original_mapping_name)
|
|
|
|
self.config.Cache.update_sonarr_adds(series.tvdbId, self.library.original_mapping_name)
|
|
|
|
if len(skipped) > 0:
|
|
|
|
if len(skipped) > 0:
|
|
|
|
logger.info("")
|
|
|
|
|
|
|
|
for series in skipped:
|
|
|
|
for series in skipped:
|
|
|
|
logger.info(f"Skipped: In Cache | {series}")
|
|
|
|
logger.info(f"Skipped: In Cache | {series}")
|
|
|
|
logger.info(f"{len(exists) + len(skipped)} Series already exist in Sonarr")
|
|
|
|
logger.info(f"{len(exists) + len(skipped)} Series already exist in Sonarr")
|
|
|
|
|
|
|
|
|
|
|
|
if len(mismatched) > 0:
|
|
|
|
if len(mismatched) > 0:
|
|
|
|
logger.info("")
|
|
|
|
logger.info("")
|
|
|
|
|
|
|
|
logger.info("Items in Plex that have already been added to Sonarr but under a different TVDb ID then in Plex")
|
|
|
|
for path, tmdb_id in mismatched.items():
|
|
|
|
for path, tmdb_id in mismatched.items():
|
|
|
|
logger.info(f"Plex TVDb ID: {tmdb_id:<7} | Sonarr TVDb ID: {arr_paths[path]:<7} | Path: {path}")
|
|
|
|
logger.info(f"Plex TVDb ID: {tmdb_id:<7} | Sonarr TVDb ID: {arr_paths[path]:<7} | Path: {path}")
|
|
|
|
logger.info(f"{len(mismatched)} Series with mismatched TVDb IDs")
|
|
|
|
logger.info(f"{len(mismatched)} Series with mismatched TVDb IDs")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(path_in_use) > 0:
|
|
|
|
|
|
|
|
logger.info("")
|
|
|
|
|
|
|
|
logger.info("TVDb IDs that cannot be added to Sonarr because the path they will use is already in use by a different TVDb ID")
|
|
|
|
|
|
|
|
for path, tvdb_id in path_in_use.items():
|
|
|
|
|
|
|
|
logger.info(f"TVDb ID: {tvdb_id:<7} | Sonarr TVDb ID: {arr_paths[path]:<7} | Path: {path}")
|
|
|
|
|
|
|
|
logger.info(f"{len(path_in_use)} Series with paths already in use by other TVDb IDs")
|
|
|
|
|
|
|
|
|
|
|
|
if len(invalid) > 0:
|
|
|
|
if len(invalid) > 0:
|
|
|
|
for tvdb_id in invalid:
|
|
|
|
for tvdb_id in invalid:
|
|
|
|
logger.info("")
|
|
|
|
logger.info("")
|
|
|
|