diff --git a/VERSION b/VERSION index 339f036f..03b0dc99 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop52 +1.16.5-develop53 diff --git a/docs/config/radarr.md b/docs/config/radarr.md index d08f37e6..8fb34f04 100644 --- a/docs/config/radarr.md +++ b/docs/config/radarr.md @@ -25,20 +25,21 @@ radarr: plex_path: /share/CACHEDEV1_DATA/Multimedia ``` -| Attribute | Allowed Values | Default | Required | -|:-------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------:|:--------:| -| `url` | Radarr URL (Including URL Base if set).
**Example:** http://192.168.1.12:32788 | N/A | ✅ | -| `token` | Radarr API Token. | N/A | ✅ | -| `add_missing` | Adds all missing movies found from all collections to Radarr.
Use the `radarr_add_missing` [Radarr Details](../metadata/details/arr.md#radarr-details) 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-details) in the collection definition to add existing 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-details) 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-details) in the collection definition to set the Monitor value per collection. | true | ❌ | -| `availability` | Default Minimum Availability to use when adding new movies.
Use the `radarr_availability` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Availability per collection.
**Options:** `announced`, `cinemas`, `released`, `db` | `announced` | ✅ | -| `quality_profile` | Default Quality Profile to use when adding new movies.
Use the `radarr_quality` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Quality Profile per collection. | N/A | ❌ | -| `tag` | Default this list or comma-separated string of tags to use when adding new movies.
Use the `radarr_tag` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Tags per collection. | ` ` | ❌ | -| `search` | Start search for missing movie when adding new movies.
Use the `radarr_search` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the search value per collection.
**boolean:** true or false | false | ❌ | -| `plex_path` | When using `add_existing` or `radarr_add_all` Convert this part of the path to `radarr_path`. | ` ` | ❌ | -| `radarr_path` | When using `add_existing` or `radarr_add_all` Convert the `plex_path` part of the path to this. | ` ` | ❌ | +| Attribute | Allowed Values | Default | Required | +|:-------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------:|:--------:| +| `url` | Radarr URL (Including URL Base if set).
**Example:** http://192.168.1.12:32788 | N/A | ✅ | +| `token` | Radarr API Token. | N/A | ✅ | +| `add_missing` | Adds all missing movies found from all collections to Radarr.
Use the `radarr_add_missing` [Radarr Details](../metadata/details/arr.md#radarr-details) 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-details) 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-details) in the collection definition to upgrade the Quality Profile 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-details) 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-details) in the collection definition to set the Monitor value per collection. | true | ❌ | +| `availability` | Default Minimum Availability to use when adding new movies.
Use the `radarr_availability` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Availability per collection.
**Options:** `announced`, `cinemas`, `released`, `db` | `announced` | ✅ | +| `quality_profile` | Default Quality Profile to use when adding new movies.
Use the `radarr_quality` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Quality Profile per collection. | N/A | ❌ | +| `tag` | Default this list or comma-separated string of tags to use when adding new movies.
Use the `radarr_tag` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the Tags per collection. | ` ` | ❌ | +| `search` | Start search for missing movie when adding new movies.
Use the `radarr_search` [Radarr Details](../metadata/details/arr.md#radarr-details) in the collection definition to set the search value per collection.
**boolean:** true or false | false | ❌ | +| `plex_path` | When using `add_existing` or `radarr_add_all` Convert this part of the path to `radarr_path`. | ` ` | ❌ | +| `radarr_path` | When using `add_existing` or `radarr_add_all` Convert the `plex_path` part of the path to this. | ` ` | ❌ | * The `token` can be found by going to `Radarr > Settings > General > Security > API Key` @@ -71,15 +72,16 @@ libraries: radarr: url: https://radarr.bing.bang token: SOME_TOKEN + add_missing: true + add_existing: false + upgrade_existing: false root_folder_path: /movies monitor: true availability: released quality_profile: Any tag: search: false - add_existing: false radarr_path: plex_path: - add_missing: true ... ``` diff --git a/docs/config/sonarr.md b/docs/config/sonarr.md index 90b62a66..20fee6d4 100644 --- a/docs/config/sonarr.md +++ b/docs/config/sonarr.md @@ -34,6 +34,7 @@ sonarr: | `token` | Sonarr API Token. | N/A | ✅ | | `add_missing` | Adds all missing shows found from all collections to Sonarr.
Use the `sonarr_add_missing` [Sonarr Details](../metadata/details/arr.md#sonarr-details) 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-details) 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-details) in the collection definition to upgrade the Quality Profile 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-details) 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-details) 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-details) in the collection definition to set the Quality Profile per collection. | N/A | ✅ | @@ -82,6 +83,7 @@ sonarr: token: SOME_TOKEN add_missing: false add_existing: false + upgrade_existing: false root_folder_path: /shows monitor: all quality_profile: HD-1080p diff --git a/docs/metadata/details/arr.md b/docs/metadata/details/arr.md index e16127ff..ff76196e 100644 --- a/docs/metadata/details/arr.md +++ b/docs/metadata/details/arr.md @@ -4,40 +4,42 @@ All the following attributes can override the global/library [Radarr](../../config/radarr) attributes which are the default unless otherwise specified. -| Attribute | Description & Values | -|:-------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `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_folder` | **Description:** Override Radarr `root_folder_path` attribute
**Values:** Folder Path | -| `radarr_monitor` | **Description:** Override Radarr `monitor` attribute
**Values:** `true` or `false` | -| `radarr_availability` | **Description:** Override Radarr `availability` attribute
**Values:** `announced`, `cinemas`, `released`, `db` | -| `radarr_quality` | **Description:** Override Radarr `quality_profile` attribute
**Values:** Radarr Quality Profile | -| `radarr_tag` | **Description:** Override Radarr `tag` attribute
**Values:** List or comma-separated string of tags | -| `radarr_search` | **Description:** Override Radarr `search` attribute
**Values:** `true` or `false` | -| `item_radarr_tag` | **Description:** Used to append a tag in Radarr for every movie found by the builders that's in Radarr
**Values:** List or comma-separated string of tags | -| `item_radarr_tag.remove` | **Description:** Used to remove existing tags in Radarr for every movie found by the builders that's in Radarr
**Values:** List or comma-separated string of tags | -| `item_radarr_tag.sync` | **Description:** Matches the tags in Radarr for every movie found by the builders that's in Radarr with the provided tags
**Values:** List or comma-separated string of tags | +| Attribute | Description & Values | +|:--------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `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_folder` | **Description:** Override Radarr `root_folder_path` attribute
**Values:** Folder Path | +| `radarr_monitor` | **Description:** Override Radarr `monitor` attribute
**Values:** `true` or `false` | +| `radarr_availability` | **Description:** Override Radarr `availability` attribute
**Values:** `announced`, `cinemas`, `released`, `db` | +| `radarr_quality` | **Description:** Override Radarr `quality_profile` attribute
**Values:** Radarr Quality Profile | +| `radarr_tag` | **Description:** Override Radarr `tag` attribute
**Values:** List or comma-separated string of tags | +| `radarr_search` | **Description:** Override Radarr `search` attribute
**Values:** `true` or `false` | +| `item_radarr_tag` | **Description:** Used to append a tag in Radarr for every movie found by the builders that's in Radarr
**Values:** List or comma-separated string of tags | +| `item_radarr_tag.remove` | **Description:** Used to remove existing tags in Radarr for every movie found by the builders that's in Radarr
**Values:** List or comma-separated string of tags | +| `item_radarr_tag.sync` | **Description:** Matches the tags in Radarr for every movie found by the builders that's in Radarr with the provided tags
**Values:** List or comma-separated string of tags | ## Sonarr Details All the following attributes can override the global/library [Sonarr](../../config/sonarr) attributes which are the default unless otherwise specified. -| Attribute | Description & Values | -|:-------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `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_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 | -| `sonarr_language` | **Description:** Override Sonarr `language_profile` attribute
**Values:** Sonarr Language Profile | -| `sonarr_series` | **Description:** Override Sonarr `series_type` attribute
**Values:** `standard`, `daily`, `anime` | -| `sonarr_season` | **Description:** Override Sonarr `season_folder` attribute
**Values:** `true` or `false` | -| `sonarr_tag` | **Description:** Override Sonarr `tag` attribute
**Values:** List or comma-separated string of tags | -| `sonarr_search` | **Description:** Override Sonarr `search` attribute
**Values:** `true` or `false` | -| `sonarr_cutoff_search` | **Description:** Override Sonarr `cutoff_search` attribute
**Values:** `true` or `false` | -| `item_sonarr_tag` | **Description:** Used to append a tag in Sonarr for every series found by the builders that's in Sonarr
**Values:** List or comma-separated string of tags | -| `item_sonarr_tag.remove` | **Description:** Used to remove existing tags in Sonarr for every series found by the builders that's in Sonarr
**Values:** List or comma-separated string of tags | -| `item_sonarr_tag.sync` | **Description:** Matches the tags in Sonarr for every series found by the builders that's in Sonarr with the provided tags
**Values:** List or comma-separated string of tags | +| Attribute | Description & Values | +|:--------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `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_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 | +| `sonarr_language` | **Description:** Override Sonarr `language_profile` attribute
**Values:** Sonarr Language Profile | +| `sonarr_series` | **Description:** Override Sonarr `series_type` attribute
**Values:** `standard`, `daily`, `anime` | +| `sonarr_season` | **Description:** Override Sonarr `season_folder` attribute
**Values:** `true` or `false` | +| `sonarr_tag` | **Description:** Override Sonarr `tag` attribute
**Values:** List or comma-separated string of tags | +| `sonarr_search` | **Description:** Override Sonarr `search` attribute
**Values:** `true` or `false` | +| `sonarr_cutoff_search` | **Description:** Override Sonarr `cutoff_search` attribute
**Values:** `true` or `false` | +| `item_sonarr_tag` | **Description:** Used to append a tag in Sonarr for every series found by the builders that's in Sonarr
**Values:** List or comma-separated string of tags | +| `item_sonarr_tag.remove` | **Description:** Used to remove existing tags in Sonarr for every series found by the builders that's in Sonarr
**Values:** List or comma-separated string of tags | +| `item_sonarr_tag.sync` | **Description:** Matches the tags in Sonarr for every series found by the builders that's in Sonarr with the provided tags
**Values:** List or comma-separated string of tags | ## Adding to Arr You can add items to Radarr/Sonarr in two different ways. diff --git a/modules/builder.py b/modules/builder.py index f13679da..a9b72a79 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -51,10 +51,13 @@ item_false_details = ["item_lock_background", "item_lock_poster", "item_lock_tit item_bool_details = ["item_tmdb_season_titles", "revert_overlay", "item_refresh"] + item_false_details item_details = ["non_item_remove_label", "item_label", "item_radarr_tag", "item_sonarr_tag", "item_overlay", "item_refresh_delay"] + item_bool_details + list(plex.item_advance_keys.keys()) none_details = ["label.sync", "item_label.sync"] -radarr_details = ["radarr_add_missing", "radarr_add_existing", "radarr_folder", "radarr_monitor", "radarr_search", "radarr_availability", "radarr_quality", "radarr_tag"] +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" +] sonarr_details = [ - "sonarr_add_missing", "sonarr_add_existing", "sonarr_folder", "sonarr_monitor", "sonarr_language", "sonarr_series", - "sonarr_quality", "sonarr_season", "sonarr_search", "sonarr_cutoff_search", "sonarr_tag" + "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" ] album_details = ["non_item_remove_label", "item_label", "item_album_sorting"] discover_types = { @@ -1002,7 +1005,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_monitor", "radarr_search"]: + if method_name in ["radarr_add_missing", "radarr_add_existing", "radarr_upgrade_existing", "radarr_monitor", "radarr_search"]: 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 @@ -1017,7 +1020,7 @@ class CollectionBuilder: self.radarr_details["tag"] = util.get_list(method_data, lower=True) def _sonarr(self, method_name, method_data): - if method_name in ["sonarr_add_missing", "sonarr_add_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"]: 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 a81436ff..1122f4f3 100644 --- a/modules/config.py +++ b/modules/config.py @@ -528,6 +528,7 @@ class ConfigFile: "token": check_for_attribute(self.data, "token", parent="radarr", default_is_none=True), "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), "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"), @@ -542,6 +543,7 @@ class ConfigFile: "token": check_for_attribute(self.data, "token", parent="sonarr", default_is_none=True), "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), "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), @@ -817,6 +819,7 @@ class ConfigFile: "token": check_for_attribute(lib, "token", parent="radarr", default=self.general["radarr"]["token"], req_default=True, 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), + "upgrade_existing": check_for_attribute(lib, "upgrade_existing", parent="radarr", var_type="bool", default=self.general["radarr"]["upgrade_existing"], 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), @@ -844,6 +847,7 @@ class ConfigFile: "token": check_for_attribute(lib, "token", parent="sonarr", default=self.general["sonarr"]["token"], req_default=True, save=False), "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), "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 62a1e6da..d98099e8 100644 --- a/modules/radarr.py +++ b/modules/radarr.py @@ -21,10 +21,12 @@ class Radarr: self.api = RadarrAPI(self.url, self.token, session=self.config.session) self.api.respect_list_exclusions_when_adding() self.api._validate_add_options(params["root_folder_path"], params["quality_profile"]) + self.profiles = self.api.quality_profile() except ArrException as e: raise Failed(e) self.add_missing = params["add_missing"] self.add_existing = params["add_existing"] + self.upgrade_existing = params["upgrade_existing"] self.root_folder_path = params["root_folder_path"] self.monitor = params["monitor"] self.availability = params["availability"] @@ -48,6 +50,7 @@ class Radarr: logger.debug(f"Radarr Adds: {_ids if _ids else ''}") for tmdb_id in _paths: logger.debug(tmdb_id) + upgrade_existing = options["upgrade_existing"] if "upgrade_existing" in options else self.upgrade_existing 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] @@ -125,6 +128,11 @@ class Radarr: mass_add() movies = [] + qp = None + for profile in self.profiles: + if (isinstance(quality_profile, int) and profile.id == quality_profile) or profile.name == quality_profile: + qp = profile + if len(added) > 0: logger.info("") for movie in added: @@ -136,10 +144,15 @@ class Radarr: if len(exists) > 0 or len(skipped) > 0: logger.info("") if len(exists) > 0: + upgrade_qp = [] for movie in exists: logger.info(f"Already in Radarr | {movie.tmdbId:<7} | {movie.title}") + if movie.qualityProfileId != qp.id: + upgrade_qp.append(movie) if self.config.Cache: self.config.Cache.update_radarr_adds(movie.tmdbId, self.library.original_mapping_name) + if upgrade_qp and upgrade_existing: + self.api.edit_multiple_movies(upgrade_qp, quality_profile=qp) if len(skipped) > 0: for movie in skipped: logger.info(f"Skipped: In Cache | {movie}") diff --git a/modules/sonarr.py b/modules/sonarr.py index 0195427b..60e4567f 100644 --- a/modules/sonarr.py +++ b/modules/sonarr.py @@ -39,10 +39,12 @@ class Sonarr: self.api = SonarrAPI(self.url, self.token, session=self.config.session) self.api.respect_list_exclusions_when_adding() self.api._validate_add_options(params["root_folder_path"], params["quality_profile"], params["language_profile"]) + self.profiles = self.api.quality_profile() except ArrException as e: raise Failed(e) self.add_missing = params["add_missing"] self.add_existing = params["add_existing"] + self.upgrade_existing = params["upgrade_existing"] self.root_folder_path = params["root_folder_path"] self.monitor = params["monitor"] self.quality_profile = params["quality_profile"] @@ -70,6 +72,7 @@ class Sonarr: logger.debug(f"Sonarr Adds: {_ids if _ids else ''}") for tvdb_id in _paths: logger.debug(tvdb_id) + upgrade_existing = options["upgrade_existing"] if "upgrade_existing" in options else self.upgrade_existing 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 @@ -151,6 +154,11 @@ class Sonarr: mass_add() shows = [] + qp = None + for profile in self.profiles: + if (isinstance(quality_profile, int) and profile.id == quality_profile) or profile.name == quality_profile: + qp = profile + if len(added) > 0: logger.info("") for series in added: @@ -162,10 +170,15 @@ class Sonarr: if len(exists) > 0 or len(skipped) > 0: logger.info("") if len(exists) > 0: + upgrade_qp = [] for series in exists: logger.info(f"Already in Sonarr | {series.tvdbId:<7} | {series.title}") + if series.qualityProfileId != qp.id: + upgrade_qp.append(series) if self.config.Cache: self.config.Cache.update_sonarr_adds(series.tvdbId, self.library.original_mapping_name) + if upgrade_qp and upgrade_existing: + self.api.edit_multiple_series(upgrade_qp, quality_profile=qp) if len(skipped) > 0: for series in skipped: logger.info(f"Skipped: In Cache | {series}")