From 28ba768606cbc0ac17b7a7576c004fa9ee50fac4 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 6 Feb 2023 22:20:05 -0500 Subject: [PATCH] [62] add ignore_cache option to the arrs --- VERSION | 2 +- docs/config/radarr.md | 1 + docs/config/sonarr.md | 1 + docs/metadata/details/arr.md | 2 ++ modules/builder.py | 8 ++++---- modules/config.py | 4 ++++ modules/radarr.py | 5 ++++- modules/sonarr.py | 5 ++++- 8 files changed, 21 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 3a015420..5d518999 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.3-develop61 +1.18.3-develop62 diff --git a/docs/config/radarr.md b/docs/config/radarr.md index 046a2194..ab9bffb0 100644 --- a/docs/config/radarr.md +++ b/docs/config/radarr.md @@ -35,6 +35,7 @@ radarr: | `add_missing` | Adds all missing movies found from all collections to Radarr.
Use the `radarr_add_missing` [Radarr Details](../metadata/details/arr.md#radarr-definition-settings) in the collection definition to add missing per collection.
**boolean:** true or false | false | ❌ | | `add_existing` | Adds all existing movies in collections to Radarr.
Use the `radarr_add_existing` [Radarr Details](../metadata/details/arr.md#radarr-definition-settings) in the collection definition to add existing per collection.
**boolean:** true or false | false | ❌ | | `upgrade_existing` | Upgrades all existing movies in collections to match the Quality Profile of the collection.
Use the `radarr_upgrade_existing` [Radarr Details](../metadata/details/arr.md#radarr-definition-settings) in the collection definition to upgrade the Quality Profile per collection.
**boolean:** true or false | false | ❌ | +| `ignore_cache` | Ignores PMM's cache when adding items to Radarr.
Use the `radarr_ignore_cache` [Radarr Details](../metadata/details/arr.md#radarr-definition-settings) in the collection definition to ignore per collection.
**boolean:** true or false | false | ❌ | | `root_folder_path` | Default Root Folder Path to use when adding new movies.
Use the `radarr_folder` [Radarr Details](../metadata/details/arr.md#radarr-definition-settings) in the collection definition to set the Root Folder per collection. | N/A | ✅ | | `monitor` | Monitor the movie when adding new movies.
Use the `radarr_monitor` [Radarr Details](../metadata/details/arr.md#radarr-definition-settings) in the collection definition to set the Monitor value per collection.
**Options:** `movie`, `collection`, `none` | true | ❌ | | `availability` | Default Minimum Availability to use when adding new movies.
Use the `radarr_availability` [Radarr Details](../metadata/details/arr.md#radarr-definition-settings) in the collection definition to set the Availability per collection.
**Options:** `announced`, `cinemas`, `released`, `db` | `announced` | ✅ | diff --git a/docs/config/sonarr.md b/docs/config/sonarr.md index b5aec798..3d29ece9 100644 --- a/docs/config/sonarr.md +++ b/docs/config/sonarr.md @@ -38,6 +38,7 @@ sonarr: | `add_missing` | Adds all missing shows found from all collections to Sonarr.
Use the `sonarr_add_missing` [Sonarr Details](../metadata/details/arr.md#sonarr-definition-settings) in the collection definition to add missing per collection.
**boolean:** true or false | false | ❌ | | `add_existing` | Adds all existing shows in collections to Sonarr.
Use the `sonarr_add_existing` [Sonarr Details](../metadata/details/arr.md#sonarr-definition-settings) in the collection definition to add existing per collection.
**boolean:** true or false | false | ❌ | | `upgrade_existing` | Upgrades all existing shows in collections to match the Quality Profile of the collection.
Use the `sonarr_upgrade_existing` [Sonarr Details](../metadata/details/arr.md#sonarr-definition-settings) in the collection definition to upgrade the Quality Profile per collection.
**boolean:** true or false | false | ❌ | +| `ignore_cache` | Ignores PMM's cache when adding items to Sonarr.
Use the `sonarr_ignore_cache` [Sonarr Details](../metadata/details/arr.md#sonarr-definition-settings) in the collection definition to ignore per collection.
**boolean:** true or false | false | ❌ | | `root_folder_path` | Default Root Folder Path to use when adding new shows.
Use the `sonarr_folder` [Sonarr Details](../metadata/details/arr.md#sonarr-definition-settings) in the collection definition to set the Root Folder per collection. | N/A | ✅ | | `monitor` | Default Monitor to use when adding new shows.
Use the `sonarr_monitor` [Sonarr Details](../metadata/details/arr.md#sonarr-definition-settings) in the collection definition to set the Monitor value per collection.
**Values:**
`all`All episodes except specials
`future`Episodes that have not aired yet
`missing`Episodes that do not have files or have not aired yet
`existing`Episodes that have files or have not aired yet
`pilot`The first episode, all others will be ignored
`first`All episodes of the first season, all others will be ignored
`latest`All episodes of the latest season and future seasons
`none`No episodes
| `all` | ❌ | | `quality_profile` | Default Quality Profile to use when adding new shows.
Use the `sonarr_quality` [Sonarr Details](../metadata/details/arr.md#sonarr-definition-settings) in the collection definition to set the Quality Profile per collection. | N/A | ✅ | diff --git a/docs/metadata/details/arr.md b/docs/metadata/details/arr.md index fffe7fda..706ee0ab 100644 --- a/docs/metadata/details/arr.md +++ b/docs/metadata/details/arr.md @@ -9,6 +9,7 @@ All the following attributes can override the global/library [Radarr](../../conf | `radarr_add_missing` | **Description:** Override Radarr `add_missing` attribute
**Values:** `true` or `false` | | `radarr_add_existing` | **Description:** Override Radarr `add_existing` attribute
**Values:** `true` or `false` | | `radarr_upgrade_existing` | **Description:** Override Radarr `upgrade_existing` attribute
**Values:** `true` or `false` | +| `radarr_ignore_cache` | **Description:** Override Radarr `ignore_cache` attribute
**Values:** `true` or `false` | | `radarr_folder` | **Description:** Override Radarr `root_folder_path` attribute
**Values:** Folder Path | | `radarr_monitor` | **Description:** Override Radarr `monitor` attribute
**Values:** `movie`, `collection`, or `none` | | `radarr_availability` | **Description:** Override Radarr `availability` attribute
**Values:** `announced`, `cinemas`, `released`, `db` | @@ -28,6 +29,7 @@ All the following attributes can override the global/library [Sonarr](../../conf | `sonarr_add_missing` | **Description:** Override Sonarr `add_missing` attribute
**Values:** `true` or `false` | | `sonarr_add_existing` | **Description:** Override Sonarr `add_existing` attribute
**Values:** `true` or `false` | | `sonarr_upgrade_existing` | **Description:** Override Sonarr `upgrade_existing` attribute
**Values:** `true` or `false` | +| `sonarr_ignore_cache` | **Description:** Override Sonarr `ignore_cache` attribute
**Values:** `true` or `false` | | `sonarr_folder` | **Description:** Override Sonarr `root_folder_path` attribute
**Values:** Folder Path | | `sonarr_monitor` | **Description:** Override Sonarr `monitor` attribute
**Values:** `all`, `future`, `missing`, `existing`, `pilot`, `first`, `latest`, `none` | | `sonarr_quality` | **Description:** Override Sonarr `quality_profile` attribute
**Values:** Sonarr Quality Profile | diff --git a/modules/builder.py b/modules/builder.py index 7c9e4694..5279352b 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -57,11 +57,11 @@ 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_search", "radarr_availability", "radarr_quality", "radarr_tag", "item_radarr_tag", "radarr_ignore_cache" ] sonarr_details = [ "sonarr_add_missing", "sonarr_add_existing", "sonarr_upgrade_existing", "sonarr_folder", "sonarr_monitor", "sonarr_language", - "sonarr_series", "sonarr_quality", "sonarr_season", "sonarr_search", "sonarr_cutoff_search", "sonarr_tag", "item_sonarr_tag" + "sonarr_series", "sonarr_quality", "sonarr_season", "sonarr_search", "sonarr_cutoff_search", "sonarr_tag", "item_sonarr_tag", "sonarr_ignore_cache" ] album_details = ["non_item_remove_label", "item_label", "item_album_sorting"] sub_filters = [ @@ -1069,7 +1069,7 @@ class CollectionBuilder: self.item_details[method_name] = str(method_data).lower() def _radarr(self, method_name, method_data): - if method_name in ["radarr_add_missing", "radarr_add_existing", "radarr_upgrade_existing", "radarr_search", "radarr_monitor"]: + if method_name in ["radarr_add_missing", "radarr_add_existing", "radarr_upgrade_existing", "radarr_search", "radarr_monitor", "radarr_ignore_cache"]: 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 @@ -1088,7 +1088,7 @@ class CollectionBuilder: self.builders.append((method_name, True)) def _sonarr(self, method_name, method_data): - if method_name in ["sonarr_add_missing", "sonarr_add_existing", "sonarr_upgrade_existing", "sonarr_season", "sonarr_search", "sonarr_cutoff_search"]: + if method_name in ["sonarr_add_missing", "sonarr_add_existing", "sonarr_upgrade_existing", "sonarr_season", "sonarr_search", "sonarr_cutoff_search", "sonarr_ignore_cache"]: self.sonarr_details[method_name[7:]] = util.parse(self.Type, method_name, method_data, datatype="bool") elif method_name in ["sonarr_folder", "sonarr_quality", "sonarr_language"]: self.sonarr_details[method_name[7:]] = method_data diff --git a/modules/config.py b/modules/config.py index ed21e72d..f699b5f6 100644 --- a/modules/config.py +++ b/modules/config.py @@ -640,6 +640,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), + "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), "availability": check_for_attribute(self.data, "availability", parent="radarr", test_list=radarr.availability_descriptions, default="announced"), @@ -655,6 +656,7 @@ class ConfigFile: "add_missing": check_for_attribute(self.data, "add_missing", parent="sonarr", var_type="bool", default=False), "add_existing": check_for_attribute(self.data, "add_existing", parent="sonarr", var_type="bool", default=False), "upgrade_existing": check_for_attribute(self.data, "upgrade_existing", parent="sonarr", var_type="bool", default=False), + "ignore_cache": check_for_attribute(self.data, "ignore_cache", parent="sonarr", var_type="bool", default=False), "root_folder_path": check_for_attribute(self.data, "root_folder_path", parent="sonarr", default_is_none=True), "monitor": check_for_attribute(self.data, "monitor", parent="sonarr", test_list=sonarr.monitor_descriptions, default="all"), "quality_profile": check_for_attribute(self.data, "quality_profile", parent="sonarr", default_is_none=True), @@ -923,6 +925,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), + "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), "availability": check_for_attribute(lib, "availability", parent="radarr", test_list=radarr.availability_descriptions, default=self.general["radarr"]["availability"], save=False), @@ -951,6 +954,7 @@ class ConfigFile: "add_missing": check_for_attribute(lib, "add_missing", parent="sonarr", var_type="bool", default=self.general["sonarr"]["add_missing"], save=False), "add_existing": check_for_attribute(lib, "add_existing", parent="sonarr", var_type="bool", default=self.general["sonarr"]["add_existing"], save=False), "upgrade_existing": check_for_attribute(lib, "upgrade_existing", parent="sonarr", var_type="bool", default=self.general["sonarr"]["upgrade_existing"], save=False), + "ignore_cache": check_for_attribute(lib, "ignore_cache", parent="sonarr", var_type="bool", default=self.general["sonarr"]["ignore_cache"], save=False), "root_folder_path": check_for_attribute(lib, "root_folder_path", parent="sonarr", default=self.general["sonarr"]["root_folder_path"], req_default=True, save=False), "monitor": check_for_attribute(lib, "monitor", parent="sonarr", test_list=sonarr.monitor_descriptions, default=self.general["sonarr"]["monitor"], save=False), "quality_profile": check_for_attribute(lib, "quality_profile", parent="sonarr", default=self.general["sonarr"]["quality_profile"], req_default=True, save=False), diff --git a/modules/radarr.py b/modules/radarr.py index bae74d94..d756ff3f 100644 --- a/modules/radarr.py +++ b/modules/radarr.py @@ -38,6 +38,7 @@ class Radarr: self.search = params["search"] self.radarr_path = params["radarr_path"] if params["radarr_path"] and params["plex_path"] else "" self.plex_path = params["plex_path"] if params["radarr_path"] and params["plex_path"] else "" + self.ignore_cache = params["ignore_cache"] def add_tmdb(self, tmdb_ids, **options): _ids = [] @@ -55,6 +56,7 @@ class Radarr: logger.debug(tmdb_id) logger.trace("") upgrade_existing = options["upgrade_existing"] if "upgrade_existing" in options else self.upgrade_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 availability = availability_translation[options["availability"] if "availability" in options else self.availability] @@ -62,6 +64,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"Ignore Cache: {ignore_cache}") logger.trace(f"Folder: {folder}") logger.trace(f"Monitor: {monitor}") logger.trace(f"Availability: {availability}") @@ -96,7 +99,7 @@ class Radarr: tmdb_id = item[0] if isinstance(item, tuple) else item logger.ghost(f"Loading TMDb ID {i}/{len(tmdb_ids)} ({tmdb_id})") try: - if self.config.Cache: + if self.config.Cache and not ignore_cache: _id = self.config.Cache.query_radarr_adds(tmdb_id, self.library.original_mapping_name) if _id: skipped.append(item) diff --git a/modules/sonarr.py b/modules/sonarr.py index 9840b025..2cd18b36 100644 --- a/modules/sonarr.py +++ b/modules/sonarr.py @@ -58,6 +58,7 @@ class Sonarr: self.cutoff_search = params["cutoff_search"] self.sonarr_path = params["sonarr_path"] if params["sonarr_path"] and params["plex_path"] else "" self.plex_path = params["plex_path"] if params["sonarr_path"] and params["plex_path"] else "" + self.ignore_cache = params["ignore_cache"] def add_tvdb(self, tvdb_ids, **options): _ids = [] @@ -74,6 +75,7 @@ class Sonarr: for tvdb_id in _paths: logger.debug(tvdb_id) upgrade_existing = options["upgrade_existing"] if "upgrade_existing" in options else self.upgrade_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 = monitor_translation[options["monitor"] if "monitor" in options else self.monitor] quality_profile = options["quality"] if "quality" in options else self.quality_profile @@ -85,6 +87,7 @@ class Sonarr: search = options["search"] if "search" in options else self.search cutoff_search = options["cutoff_search"] if "cutoff_search" in options else self.cutoff_search logger.trace(f"Upgrade Existing: {upgrade_existing}") + logger.trace(f"Ignore Cache: {ignore_cache}") logger.trace(f"Folder: {folder}") logger.trace(f"Monitor: {monitor}") logger.trace(f"Quality Profile: {quality_profile}") @@ -120,7 +123,7 @@ class Sonarr: tvdb_id = item[0] if isinstance(item, tuple) else item logger.ghost(f"Loading TVDb ID {i}/{len(tvdb_ids)} ({tvdb_id})") try: - if self.config.Cache: + if self.config.Cache and not ignore_cache: _id = self.config.Cache.query_sonarr_adds(tvdb_id, self.library.original_mapping_name) if _id: skipped.append(item)