Radarr Monitor existing movies

This is a small change that allows you to re-monitor a movie in Radarr that was previously unmonitored.

The use case here is:
You have something in radarr and radarr is set to unmonitor files that have been deleted. A file gets deleted but it reappears on one of the popular lists. In this circumstance I want to monitor it again and get it next time it appears in the RSS.
This commit is contained in:
hjone72 2024-01-14 08:36:09 +11:00
parent acab77151f
commit fa59818326
4 changed files with 20 additions and 2 deletions

View file

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

View file

@ -59,7 +59,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"] none_details = ["label.sync", "item_label.sync", "item_genre.sync", "radarr_taglist", "sonarr_taglist", "item_edition"]
radarr_details = [ radarr_details = [
"radarr_add_missing", "radarr_add_existing", "radarr_upgrade_existing", "radarr_folder", "radarr_monitor", "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_details = [
"sonarr_add_missing", "sonarr_add_existing", "sonarr_upgrade_existing", "sonarr_folder", "sonarr_monitor", "sonarr_language", "sonarr_add_missing", "sonarr_add_existing", "sonarr_upgrade_existing", "sonarr_folder", "sonarr_monitor", "sonarr_language",
@ -1326,7 +1327,7 @@ class CollectionBuilder:
self.item_details[method_name] = str(method_data).lower() # noqa self.item_details[method_name] = str(method_data).lower() # noqa
def _radarr(self, method_name, method_data): 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") self.radarr_details[method_name[7:]] = util.parse(self.Type, method_name, method_data, datatype="bool")
elif method_name == "radarr_folder": elif method_name == "radarr_folder":
self.radarr_details["folder"] = method_data self.radarr_details["folder"] = method_data

View file

@ -726,6 +726,7 @@ class ConfigFile:
"add_missing": check_for_attribute(self.data, "add_missing", parent="radarr", var_type="bool", default=False), "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), "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), "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), "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), "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), "monitor": check_for_attribute(self.data, "monitor", parent="radarr", var_type="bool", default=True),
@ -1104,6 +1105,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_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), "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), "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), "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), "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), "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_missing = params["add_missing"]
self.add_existing = params["add_existing"] self.add_existing = params["add_existing"]
self.upgrade_existing = params["upgrade_existing"] self.upgrade_existing = params["upgrade_existing"]
self.monitor_existing = params["monitor_existing"]
self.root_folder_path = params["root_folder_path"] self.root_folder_path = params["root_folder_path"]
self.monitor = params["monitor"] self.monitor = params["monitor"]
self.availability = params["availability"] self.availability = params["availability"]
@ -56,6 +57,7 @@ class Radarr:
logger.debug(tmdb_id) logger.debug(tmdb_id)
logger.trace("") logger.trace("")
upgrade_existing = options["upgrade_existing"] if "upgrade_existing" in options else self.upgrade_existing 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 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 folder = options["folder"] if "folder" in options else self.root_folder_path
monitor = options["monitor"] if "monitor" in options else self.monitor 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 tags = options["tag"] if "tag" in options else self.tag
search = options["search"] if "search" in options else self.search search = options["search"] if "search" in options else self.search
logger.trace(f"Upgrade Existing: {upgrade_existing}") logger.trace(f"Upgrade Existing: {upgrade_existing}")
logger.trace(f"Monitor Existing: {monitor_existing}")
logger.trace(f"Ignore Cache: {ignore_cache}") logger.trace(f"Ignore Cache: {ignore_cache}")
logger.trace(f"Folder: {folder}") logger.trace(f"Folder: {folder}")
logger.trace(f"Monitor: {monitor}") logger.trace(f"Monitor: {monitor}")
@ -157,13 +160,22 @@ class Radarr:
logger.info("") logger.info("")
if len(exists) > 0: if len(exists) > 0:
upgrade_qp = [] upgrade_qp = []
remonitor_existing = []
for movie in exists: 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: if movie.qualityProfileId != qp.id and upgrade_existing:
upgrade_qp.append(movie) upgrade_qp.append(movie)
else: else:
logger.info(f"Already in Radarr | {movie.tmdbId:<7} | {movie.title}") logger.info(f"Already in Radarr | {movie.tmdbId:<7} | {movie.title}")
if self.config.Cache: if self.config.Cache:
self.config.Cache.update_radarr_adds(movie.tmdbId, self.library.original_mapping_name) 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: if upgrade_qp:
self.api.edit_multiple_movies(upgrade_qp, quality_profile=qp) self.api.edit_multiple_movies(upgrade_qp, quality_profile=qp)
for movie in upgrade_qp: for movie in upgrade_qp: