mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
check arr paths for new IDs
This commit is contained in:
parent
23c5af19e2
commit
aebe78799f
3 changed files with 27 additions and 2 deletions
|
@ -19,6 +19,7 @@ class Radarr:
|
||||||
try:
|
try:
|
||||||
self.api = RadarrAPI(self.url, self.token, session=self.config.session)
|
self.api = RadarrAPI(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"])
|
||||||
except ArrException as e:
|
except ArrException as e:
|
||||||
raise Failed(e)
|
raise Failed(e)
|
||||||
self.add = params["add"]
|
self.add = params["add"]
|
||||||
|
@ -67,6 +68,7 @@ class Radarr:
|
||||||
movies = []
|
movies = []
|
||||||
path_lookup = {}
|
path_lookup = {}
|
||||||
mismatched = {}
|
mismatched = {}
|
||||||
|
path_in_use = {}
|
||||||
for i, item in enumerate(tmdb_ids, 1):
|
for i, item in enumerate(tmdb_ids, 1):
|
||||||
path = item[1] if isinstance(item, tuple) else None
|
path = item[1] if isinstance(item, tuple) else None
|
||||||
tmdb_id = item[0] if isinstance(item, tuple) else item
|
tmdb_id = item[0] if isinstance(item, tuple) else item
|
||||||
|
@ -84,6 +86,9 @@ class Radarr:
|
||||||
mismatched[path] = tmdb_id
|
mismatched[path] = tmdb_id
|
||||||
continue
|
continue
|
||||||
movie = self.api.get_movie(tmdb_id=tmdb_id)
|
movie = self.api.get_movie(tmdb_id=tmdb_id)
|
||||||
|
if f"{folder}/{movie.folder}" in arr_paths:
|
||||||
|
path_in_use[f"{folder}/{movie.folder}"] = tmdb_id
|
||||||
|
continue
|
||||||
if path:
|
if path:
|
||||||
movies.append((movie, path))
|
movies.append((movie, path))
|
||||||
path_lookup[path] = tmdb_id
|
path_lookup[path] = tmdb_id
|
||||||
|
@ -124,10 +129,18 @@ class Radarr:
|
||||||
|
|
||||||
if len(mismatched) > 0:
|
if len(mismatched) > 0:
|
||||||
logger.info("")
|
logger.info("")
|
||||||
|
logger.info("Items in Plex that have already been added to Radarr but under a different TMDb ID then in Plex")
|
||||||
for path, tmdb_id in mismatched.items():
|
for path, tmdb_id in mismatched.items():
|
||||||
logger.info(f"Plex TMDb ID: {tmdb_id:<7} | Radarr TMDb ID: {arr_paths[path]:<7} | Path: {path}")
|
logger.info(f"Plex TMDb ID: {tmdb_id:<7} | Radarr TMDb ID: {arr_paths[path]:<7} | Path: {path}")
|
||||||
logger.info(f"{len(mismatched)} Movie{'s' if len(mismatched) > 1 else ''} with mismatched TMDb IDs")
|
logger.info(f"{len(mismatched)} Movie{'s' if len(mismatched) > 1 else ''} with mismatched TMDb IDs")
|
||||||
|
|
||||||
|
if len(path_in_use) > 0:
|
||||||
|
logger.info("")
|
||||||
|
logger.info("TMDb IDs that cannot be added to Radarr because the path they will use is already in use by a different TMDb ID")
|
||||||
|
for path, tmdb_id in path_in_use.items():
|
||||||
|
logger.info(f"TMDb ID: {tmdb_id:<7} | Radarr TMDb ID: {arr_paths[path]:<7} | Path: {path}")
|
||||||
|
logger.info(f"{len(path_in_use)} Movie{'s' if len(path_in_use) > 1 else ''} with paths already in use by other TMDb IDs")
|
||||||
|
|
||||||
if len(invalid) > 0:
|
if len(invalid) > 0:
|
||||||
logger.info("")
|
logger.info("")
|
||||||
for tmdb_id in invalid:
|
for tmdb_id in invalid:
|
||||||
|
|
|
@ -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("")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
PlexAPI==4.8.0
|
PlexAPI==4.8.0
|
||||||
tmdbv3api==1.7.6
|
tmdbv3api==1.7.6
|
||||||
arrapi==1.2.7
|
arrapi==1.2.8
|
||||||
lxml==4.6.4
|
lxml==4.6.4
|
||||||
requests==2.26.0
|
requests==2.26.0
|
||||||
ruamel.yaml==0.17.17
|
ruamel.yaml==0.17.17
|
||||||
|
|
Loading…
Reference in a new issue