[14] Merge remote-tracking branch 'hjone72/radarr_monitor-existing' into nightly

This commit is contained in:
meisnate12 2024-01-18 13:19:09 -05:00
commit 35898e9584
4 changed files with 20 additions and 2 deletions

View file

@ -240,6 +240,7 @@ templates:
radarr_tag_<<key>>: <<radarr_tag>>
sonarr_tag_<<key>>: <<sonarr_tag>>
radarr_monitor_<<key>>: <<radarr_monitor>>
radarr_monitor_existing_<<key>>: <<radarr_monitor_existing>>
sonarr_monitor_<<key>>: <<sonarr_monitor>>
radarr_search_<<key>>: <<radarr_search>>
sonarr_search_<<key>>: <<sonarr_search>>
@ -251,6 +252,7 @@ templates:
- radarr_tag
- sonarr_tag
- radarr_monitor
- radarr_monitor_existing
- sonarr_monitor
- radarr_search
- sonarr_search
@ -261,6 +263,7 @@ templates:
radarr_tag: <<radarr_tag_<<key>>>>
sonarr_tag: <<sonarr_tag_<<key>>>>
radarr_monitor: <<radarr_monitor_<<key>>>>
radarr_monitor_existing: <<radarr_monitor_existing_<<key>>>>
sonarr_monitor: <<sonarr_monitor_<<key>>>>
radarr_search: <<radarr_search_<<key>>>>
sonarr_search: <<sonarr_search_<<key>>>>

View file

@ -61,7 +61,8 @@ item_details = ["non_item_remove_label", "item_label", "item_genre", "item_editi
none_details = ["label.sync", "item_label.sync", "item_genre.sync", "radarr_taglist", "sonarr_taglist", "item_edition"]
radarr_details = [
"radarr_add_missing", "radarr_add_existing", "radarr_upgrade_existing", "radarr_folder", "radarr_monitor",
"radarr_search", "radarr_availability", "radarr_quality", "radarr_tag", "item_radarr_tag", "radarr_ignore_cache"
"radarr_search", "radarr_availability", "radarr_quality", "radarr_tag", "item_radarr_tag", "radarr_ignore_cache",
"radarr_monitor_existing"
]
sonarr_details = [
"sonarr_add_missing", "sonarr_add_existing", "sonarr_upgrade_existing", "sonarr_folder", "sonarr_monitor", "sonarr_language",
@ -1331,7 +1332,7 @@ class CollectionBuilder:
self.item_details[method_name] = str(method_data).lower() # noqa
def _radarr(self, method_name, method_data):
if method_name in ["radarr_add_missing", "radarr_add_existing", "radarr_upgrade_existing", "radarr_search", "radarr_monitor", "radarr_ignore_cache"]:
if method_name in ["radarr_add_missing", "radarr_add_existing", "radarr_upgrade_existing", "radarr_search", "radarr_monitor", "radarr_ignore_cache", "radarr_monitor_existing"]:
self.radarr_details[method_name[7:]] = util.parse(self.Type, method_name, method_data, datatype="bool")
elif method_name == "radarr_folder":
self.radarr_details["folder"] = method_data

View file

@ -728,6 +728,7 @@ class ConfigFile:
"add_missing": check_for_attribute(self.data, "add_missing", parent="radarr", var_type="bool", default=False),
"add_existing": check_for_attribute(self.data, "add_existing", parent="radarr", var_type="bool", default=False),
"upgrade_existing": check_for_attribute(self.data, "upgrade_existing", parent="radarr", var_type="bool", default=False),
"monitor_existing": check_for_attribute(self.data, "monitor_existing", parent="radarr", var_type="bool", default=False),
"ignore_cache": check_for_attribute(self.data, "ignore_cache", parent="radarr", var_type="bool", default=False),
"root_folder_path": check_for_attribute(self.data, "root_folder_path", parent="radarr", default_is_none=True),
"monitor": check_for_attribute(self.data, "monitor", parent="radarr", var_type="bool", default=True),
@ -1106,6 +1107,7 @@ class ConfigFile:
"add_missing": check_for_attribute(lib, "add_missing", parent="radarr", var_type="bool", default=self.general["radarr"]["add_missing"], save=False),
"add_existing": check_for_attribute(lib, "add_existing", parent="radarr", var_type="bool", default=self.general["radarr"]["add_existing"], save=False),
"upgrade_existing": check_for_attribute(lib, "upgrade_existing", parent="radarr", var_type="bool", default=self.general["radarr"]["upgrade_existing"], save=False),
"monitor_existing": check_for_attribute(lib, "monitor_existing", parent="radarr", var_type="bool", default=self.general["radarr"]["monitor_existing"], save=False),
"ignore_cache": check_for_attribute(lib, "ignore_cache", parent="radarr", var_type="bool", default=self.general["radarr"]["ignore_cache"], save=False),
"root_folder_path": check_for_attribute(lib, "root_folder_path", parent="radarr", default=self.general["radarr"]["root_folder_path"], req_default=True, save=False),
"monitor": check_for_attribute(lib, "monitor", parent="radarr", var_type="bool", default=self.general["radarr"]["monitor"], save=False),

View file

@ -30,6 +30,7 @@ class Radarr:
self.add_missing = params["add_missing"]
self.add_existing = params["add_existing"]
self.upgrade_existing = params["upgrade_existing"]
self.monitor_existing = params["monitor_existing"]
self.root_folder_path = params["root_folder_path"]
self.monitor = params["monitor"]
self.availability = params["availability"]
@ -56,6 +57,7 @@ class Radarr:
logger.debug(tmdb_id)
logger.trace("")
upgrade_existing = options["upgrade_existing"] if "upgrade_existing" in options else self.upgrade_existing
monitor_existing = options["monitor_existing"] if "monitor_existing" in options else self.monitor_existing
ignore_cache = options["ignore_cache"] if "ignore_cache" in options else self.ignore_cache
folder = options["folder"] if "folder" in options else self.root_folder_path
monitor = options["monitor"] if "monitor" in options else self.monitor
@ -64,6 +66,7 @@ class Radarr:
tags = options["tag"] if "tag" in options else self.tag
search = options["search"] if "search" in options else self.search
logger.trace(f"Upgrade Existing: {upgrade_existing}")
logger.trace(f"Monitor Existing: {monitor_existing}")
logger.trace(f"Ignore Cache: {ignore_cache}")
logger.trace(f"Folder: {folder}")
logger.trace(f"Monitor: {monitor}")
@ -157,13 +160,22 @@ class Radarr:
logger.info("")
if len(exists) > 0:
upgrade_qp = []
remonitor_existing = []
for movie in exists:
if movie.monitored != True and monitor_existing:
remonitor_existing.append(movie)
else:
logger.info(f"Already in Radarr | {movie.tmdbId:<7} | {movie.title}")
if movie.qualityProfileId != qp.id and upgrade_existing:
upgrade_qp.append(movie)
else:
logger.info(f"Already in Radarr | {movie.tmdbId:<7} | {movie.title}")
if self.config.Cache:
self.config.Cache.update_radarr_adds(movie.tmdbId, self.library.original_mapping_name)
if remonitor_existing:
self.api.edit_multiple_movies(remonitor_existing, monitored=True)
for movie in remonitor_existing:
logger.info(f"Remonitored in Radarr | {movie.tmdbId:<7} | {movie.title}")
if upgrade_qp:
self.api.edit_multiple_movies(upgrade_qp, quality_profile=qp)
for movie in upgrade_qp: