diff --git a/VERSION b/VERSION index 67393404..edf344ca 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.3-develop83 +1.18.3-develop84 diff --git a/defaults/both/streaming.yml b/defaults/both/streaming.yml index 929e4baf..d4fd9dea 100644 --- a/defaults/both/streaming.yml +++ b/defaults/both/streaming.yml @@ -62,7 +62,7 @@ templates: sync_mode_<>: <> sort_by: release.desc sort_by_<>: <> - allowed_library_types: + run_definition: - <>>> - <> - <> diff --git a/defaults/overlays/languages.yml b/defaults/overlays/languages.yml index 4fee4895..a6bf7f1f 100644 --- a/defaults/overlays/languages.yml +++ b/defaults/overlays/languages.yml @@ -290,7 +290,7 @@ templates: - use_subtitles: true value: subtitle_language ignore_blank_results: true - allowed_library_types: + run_definition: - <>>> plex_search: all: diff --git a/defaults/overlays/ratings.yml b/defaults/overlays/ratings.yml index 1de095a2..540de7c2 100644 --- a/defaults/overlays/ratings.yml +++ b/defaults/overlays/ratings.yml @@ -442,7 +442,7 @@ templates: mdblist_list: <> imdb_chart: <> overlay_level: <> - allowed_library_types: <> + run_definition: <> ignore_blank_results: true overlay: name: text(<>>>_rating<>_style>>) diff --git a/defaults/overlays/resolution.yml b/defaults/overlays/resolution.yml index 343757b9..e2162322 100644 --- a/defaults/overlays/resolution.yml +++ b/defaults/overlays/resolution.yml @@ -135,7 +135,7 @@ templates: - use_<> - use_edition - allowed_libraries - allowed_library_types: + run_definition: - <>>> - <> - <> @@ -178,7 +178,7 @@ templates: - use_<> - use_resolution - allowed_libraries - allowed_library_types: + run_definition: - <>>> - <>>> - <>_<>>> diff --git a/defaults/overlays/streaming.yml b/defaults/overlays/streaming.yml index d0584f59..9466f498 100644 --- a/defaults/overlays/streaming.yml +++ b/defaults/overlays/streaming.yml @@ -9,7 +9,7 @@ external_templates: pmm: templates template_variables: - allowed_library_types: + run_definition: - <>>> - <>>> - <> @@ -49,7 +49,7 @@ external_templates: templates: mdb_streaming: - allowed_library_types: + run_definition: - <> ignore_blank_results: true mdblist_list: https://mdblist.com/lists/plexmetamanager/<>-<>s<> diff --git a/defaults/overlays/templates.yml b/defaults/overlays/templates.yml index 69cc15c8..2f8ab41b 100644 --- a/defaults/overlays/templates.yml +++ b/defaults/overlays/templates.yml @@ -64,7 +64,7 @@ templates: - addon_offset - addon_position overlay_level: <> - allowed_library_types: + run_definition: - <>>> - <>>> - <> diff --git a/defaults/playlist.yml b/defaults/playlist.yml index c075abf9..b72a14fb 100644 --- a/defaults/playlist.yml +++ b/defaults/playlist.yml @@ -32,7 +32,7 @@ templates: - sync_to_users - exclude_users - delete_playlist - allowed_library_types: + run_definition: - <>>> ignore_ids: <> ignore_imdb_ids: <> diff --git a/defaults/templates.yml b/defaults/templates.yml index 234d0a4d..82090e4e 100644 --- a/defaults/templates.yml +++ b/defaults/templates.yml @@ -21,7 +21,7 @@ templates: value: false - placeholder_imdb_id.exists: true value: false - allowed_library_types: <> + run_definition: <> collection_mode: <> sort_title: "!<>_!<>" tmdb_movie: <> @@ -60,7 +60,7 @@ templates: - ignore_ids - ignore_imdb_ids - minimum_items - allowed_library_types: + run_definition: - <>>> - <> ignore_ids: <> @@ -201,13 +201,13 @@ templates: pre: "_~" optional: - use_other - allowed_library_types: <> + run_definition: <> sort_title: "!<><
><>"
 
   use_year_collections:
     optional:
       - use_year_collections
-    allowed_library_types: <>
+    run_definition: <>
 
   translation:
     default:
diff --git a/docs/metadata/details/definition.md b/docs/metadata/details/definition.md
index 6933f017..7ed703fa 100644
--- a/docs/metadata/details/definition.md
+++ b/docs/metadata/details/definition.md
@@ -30,7 +30,7 @@ All the following attributes serve various functions as how the definition funct
 | `changes_webhooks`           | **Description:** Used to specify a definition changes webhook for just this definition.
**Values:** List of webhooks | | `sync_to_trakt_list` | **Description:** Used to specify a trakt list you want the definition synced to.
**Values:** Trakt List Slug you want to sync to | | `sync_missing_to_trakt_list` | **Description:** Used to also sync missing items to the Trakt List specified by `sync_to_trakt_list`.
**Default:** `false`
**Values:** `true` or `false` | -| `allowed_library_types` | **Description:** Used to specify the types of libraries that this definition can work with.
Multiple can be used for one definition as a list or comma separated string. One `false` will cause it to fail.
**Values:** `movie`, `show`, `artist`, `true`, `false` | +| `run_definition` | **Description:** Used to specify if you want this definition to run.
Multiple can be used for one definition as a list or comma separated string. One `false` or unmatched library type will cause it to fail.
**Values:** `movie`, `show`, `artist`, `true`, `false` | | `default_percent` | **Description:** Used to declare the default percent for `episodes`, `seasons`, `tracks`, and `albums` [special filters](../filters.md#special-filters). Default is 50.
**Values:** Integer between 1 and 100 | | `ignore_blank_results` | **Description:** Used to not have Errors resulting from blank results from builders.
**Default:** `false`
**Values:** `true` or `false` | | `only_run_on_create` | **Description:** Used to only run the collection definition if the collection doesn't already exist.
**Default:** `false`
**Values:** `true` or `false` | diff --git a/modules/builder.py b/modules/builder.py index c08fe2cb..eecaa29a 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -43,7 +43,7 @@ ignored_details = [ "smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "variables", "test", "suppress_overlays", "delete_not_scheduled", "tmdb_person", "build_collection", "collection_order", "builder_level", "overlay", "validate_builders", "libraries", "sync_to_users", "exclude_users", "collection_name", "playlist_name", "name", - "blank_collection", "allowed_library_types", "delete_playlist", "ignore_blank_results", "only_run_on_create", + "blank_collection", "allowed_library_types", "run_definition", "delete_playlist", "ignore_blank_results", "only_run_on_create", "delete_collections_named", "tmdb_person_offset" ] details = [ @@ -165,7 +165,7 @@ parts_collection_valid = [ "url_theme", "file_theme", "item_label", "default_percent" ] + episode_parts_only + summary_details + poster_details + background_details + string_details playlist_attributes = [ - "filters", "name_mapping", "show_filtered", "show_missing", "save_report", "allowed_library_types", + "filters", "name_mapping", "show_filtered", "show_missing", "save_report", "allowed_library_types", "run_definition", "missing_only_released", "only_filter_missing", "delete_below_minimum", "ignore_ids", "ignore_imdb_ids", "server_preroll", "changes_webhooks", "minimum_items", "cache_builders", "default_percent" ] + custom_sort_builders + summary_details + poster_details + radarr_details + sonarr_details @@ -273,22 +273,24 @@ class CollectionBuilder: if self.obj and self.only_run_on_create: raise NotScheduled("Skipped because only_run_on_create is True and the collection already exists") - if "allowed_library_types" in methods: + if "allowed_library_types" in methods and "run_definition" not in methods: + logger.warning(f"{self.Type} Warning: allowed_library_types will run as run_definition") + methods["run_definition"] = methods["allowed_library_types"] + + if "run_definition" in methods: logger.debug("") - logger.debug("Validating Method: allowed_library_types") - if self.data[methods["allowed_library_types"]] is None: - raise NotScheduled("Skipped because allowed_library_types has no library types") - logger.debug(f"Value: {self.data[methods['allowed_library_types']]}") - found_type = False - for library_type in util.get_list(self.data[methods["allowed_library_types"]], lower=True): - if library_type == "true" or (self.library and library_type == self.library.Plex.type): - found_type = True + logger.debug("Validating Method: run_definition") + if self.data[methods["run_definition"]] is None: + raise NotScheduled("Skipped because run_definition has no value") + logger.debug(f"Value: {self.data[methods['run_definition']]}") + valid_options = ["true", "false"] + plex.library_types + for library_type in util.get_list(self.data[methods["run_definition"]], lower=True): + if library_type not in valid_options: + raise Failed(f"{self.Type} Error: {library_type} is invalid. Options: true, false, {', '.join(plex.library_types)}") elif library_type == "false": - raise NotScheduled(f"Skipped because allowed_library_types is false") - elif library_type not in plex.library_types: - raise Failed(f"{self.Type} Error: {library_type} is invalid. Options: {', '.join(plex.library_types)}") - if not found_type: - raise NotScheduled(f"Skipped because allowed_library_types {self.data[methods['allowed_library_types']]} doesn't match the library type: {self.library.Plex.type}") + raise NotScheduled(f"Skipped because run_definition is false") + elif library_type != "true" and self.library and library_type != self.library.Plex.type: + raise NotScheduled(f"Skipped because run_definition library_type: {library_type} doesn't match") if self.playlist: self.builder_level = "item" elif self.library.is_show: self.builder_level = "show" diff --git a/plex_meta_manager.py b/plex_meta_manager.py index da12885e..c3d91075 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -535,7 +535,8 @@ def run_libraries(config): for library_type in library_types: for item in library.get_all(builder_level=library_type): try: - library.edit_tags("label", item, sync_tags=[]) + sync = ["Overlay"] if "Overlay" in [i.tag for i in item.labels] else [] + library.edit_tags("label", item, sync_tags=sync) except NotFound: logger.error(f"{item.title[:25]:<25} | Labels Failed to be Removed") library_status[library.name]["All Labels Deleted"] = str(datetime.now() - time_start).split('.')[0] @@ -774,8 +775,8 @@ def run_collection(config, library, metadata, requested_collections): library.notify_delete(e) library.stats["deleted"] += 1 library.status[str(mapping_name)]["status"] = "Deleted Not Scheduled" - elif str(e).startswith("Skipped because allowed_library_types"): - library.status[str(mapping_name)]["status"] = "Skipped Invalid Library Type" + elif str(e).startswith("Skipped because run_definition"): + library.status[str(mapping_name)]["status"] = "Skipped Run Definition" else: library.status[str(mapping_name)]["status"] = "Not Scheduled" except FilterFailed: