[84] changed allowed_library_types to run_definition

pull/1324/head
meisnate12 2 years ago
parent 05826f9dff
commit 064a85f2ce

@ -1 +1 @@
1.18.3-develop83 1.18.3-develop84

@ -62,7 +62,7 @@ templates:
sync_mode_<<key>>: <<sync_mode>> sync_mode_<<key>>: <<sync_mode>>
sort_by: release.desc sort_by: release.desc
sort_by_<<key>>: <<sort_by>> sort_by_<<key>>: <<sort_by>>
allowed_library_types: run_definition:
- <<use_<<key>>>> - <<use_<<key>>>>
- <<allowed_libraries>> - <<allowed_libraries>>
- <<allowed_streaming>> - <<allowed_streaming>>

@ -290,7 +290,7 @@ templates:
- use_subtitles: true - use_subtitles: true
value: subtitle_language value: subtitle_language
ignore_blank_results: true ignore_blank_results: true
allowed_library_types: run_definition:
- <<use_<<key>>>> - <<use_<<key>>>>
plex_search: plex_search:
all: all:

@ -442,7 +442,7 @@ templates:
mdblist_list: <<mdblist_top>> mdblist_list: <<mdblist_top>>
imdb_chart: <<imdb_top>> imdb_chart: <<imdb_top>>
overlay_level: <<overlay_level>> overlay_level: <<overlay_level>>
allowed_library_types: <<run_this>> run_definition: <<run_this>>
ignore_blank_results: true ignore_blank_results: true
overlay: overlay:
name: text(<<rating<<rating_num>>>>_rating<<rating<<rating_num>>_style>>) name: text(<<rating<<rating_num>>>>_rating<<rating<<rating_num>>_style>>)

@ -135,7 +135,7 @@ templates:
- use_<<key>> - use_<<key>>
- use_edition - use_edition
- allowed_libraries - allowed_libraries
allowed_library_types: run_definition:
- <<use_<<key>>>> - <<use_<<key>>>>
- <<use_edition>> - <<use_edition>>
- <<allowed_libraries>> - <<allowed_libraries>>
@ -178,7 +178,7 @@ templates:
- use_<<alt>> - use_<<alt>>
- use_resolution - use_resolution
- allowed_libraries - allowed_libraries
allowed_library_types: run_definition:
- <<use_<<key>>>> - <<use_<<key>>>>
- <<use_<<alt>>>> - <<use_<<alt>>>>
- <<use_<<key>>_<<alt>>>> - <<use_<<key>>_<<alt>>>>

@ -9,7 +9,7 @@
external_templates: external_templates:
pmm: templates pmm: templates
template_variables: template_variables:
allowed_library_types: run_definition:
- <<use_<<key>>>> - <<use_<<key>>>>
- <<use_<<alt>>>> - <<use_<<alt>>>>
- <<allowed_libraries>> - <<allowed_libraries>>
@ -49,7 +49,7 @@ external_templates:
templates: templates:
mdb_streaming: mdb_streaming:
allowed_library_types: run_definition:
- <<allowed_streaming>> - <<allowed_streaming>>
ignore_blank_results: true ignore_blank_results: true
mdblist_list: https://mdblist.com/lists/plexmetamanager/<<key>>-<<library_type>>s<<watch_region>> mdblist_list: https://mdblist.com/lists/plexmetamanager/<<key>>-<<library_type>>s<<watch_region>>

@ -64,7 +64,7 @@ templates:
- addon_offset - addon_offset
- addon_position - addon_position
overlay_level: <<overlay_level>> overlay_level: <<overlay_level>>
allowed_library_types: run_definition:
- <<use_<<key>>>> - <<use_<<key>>>>
- <<use_<<alt>>>> - <<use_<<alt>>>>
- <<allowed_libraries>> - <<allowed_libraries>>

@ -32,7 +32,7 @@ templates:
- sync_to_users - sync_to_users
- exclude_users - exclude_users
- delete_playlist - delete_playlist
allowed_library_types: run_definition:
- <<use_<<key>>>> - <<use_<<key>>>>
ignore_ids: <<ignore_ids>> ignore_ids: <<ignore_ids>>
ignore_imdb_ids: <<ignore_imdb_ids>> ignore_imdb_ids: <<ignore_imdb_ids>>

@ -21,7 +21,7 @@ templates:
value: false value: false
- placeholder_imdb_id.exists: true - placeholder_imdb_id.exists: true
value: false value: false
allowed_library_types: <<use_separator>> run_definition: <<use_separator>>
collection_mode: <<collection_mode>> collection_mode: <<collection_mode>>
sort_title: "!<<collection_section>>_!<<collection_name>>" sort_title: "!<<collection_section>>_!<<collection_name>>"
tmdb_movie: <<placeholder_tmdb_movie>> tmdb_movie: <<placeholder_tmdb_movie>>
@ -60,7 +60,7 @@ templates:
- ignore_ids - ignore_ids
- ignore_imdb_ids - ignore_imdb_ids
- minimum_items - minimum_items
allowed_library_types: run_definition:
- <<use_<<key>>>> - <<use_<<key>>>>
- <<allowed_libraries>> - <<allowed_libraries>>
ignore_ids: <<ignore_ids>> ignore_ids: <<ignore_ids>>
@ -201,13 +201,13 @@ templates:
pre: "_~" pre: "_~"
optional: optional:
- use_other - use_other
allowed_library_types: <<use_other>> run_definition: <<use_other>>
sort_title: "!<<collection_section>><<pre>><<sort>>" sort_title: "!<<collection_section>><<pre>><<sort>>"
use_year_collections: use_year_collections:
optional: optional:
- use_year_collections - use_year_collections
allowed_library_types: <<use_year_collections>> run_definition: <<use_year_collections>>
translation: translation:
default: default:

@ -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.<br>**Values:** List of webhooks | | `changes_webhooks` | **Description:** Used to specify a definition changes webhook for just this definition.<br>**Values:** List of webhooks |
| `sync_to_trakt_list` | **Description:** Used to specify a trakt list you want the definition synced to.<br>**Values:** Trakt List Slug you want to sync to | | `sync_to_trakt_list` | **Description:** Used to specify a trakt list you want the definition synced to.<br>**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`.<br>**Default:** `false`<br>**Values:** `true` or `false` | | `sync_missing_to_trakt_list` | **Description:** Used to also sync missing items to the Trakt List specified by `sync_to_trakt_list`.<br>**Default:** `false`<br>**Values:** `true` or `false` |
| `allowed_library_types` | **Description:** Used to specify the types of libraries that this definition can work with.<br>Multiple can be used for one definition as a list or comma separated string. One `false` will cause it to fail.<br>**Values:** `movie`, `show`, `artist`, `true`, `false` | | `run_definition` | **Description:** Used to specify if you want this definition to run.<br>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.<br>**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.<br>**Values:** Integer between 1 and 100 | | `default_percent` | **Description:** Used to declare the default percent for `episodes`, `seasons`, `tracks`, and `albums` [special filters](../filters.md#special-filters). Default is 50.<br>**Values:** Integer between 1 and 100 |
| `ignore_blank_results` | **Description:** Used to not have Errors resulting from blank results from builders.<br>**Default:** `false`<br>**Values:** `true` or `false` | | `ignore_blank_results` | **Description:** Used to not have Errors resulting from blank results from builders.<br>**Default:** `false`<br>**Values:** `true` or `false` |
| `only_run_on_create` | **Description:** Used to only run the collection definition if the collection doesn't already exist.<br>**Default:** `false`<br>**Values:** `true` or `false` | | `only_run_on_create` | **Description:** Used to only run the collection definition if the collection doesn't already exist.<br>**Default:** `false`<br>**Values:** `true` or `false` |

@ -43,7 +43,7 @@ ignored_details = [
"smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "variables", "test", "suppress_overlays", "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", "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", "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" "delete_collections_named", "tmdb_person_offset"
] ]
details = [ details = [
@ -165,7 +165,7 @@ parts_collection_valid = [
"url_theme", "file_theme", "item_label", "default_percent" "url_theme", "file_theme", "item_label", "default_percent"
] + episode_parts_only + summary_details + poster_details + background_details + string_details ] + episode_parts_only + summary_details + poster_details + background_details + string_details
playlist_attributes = [ 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", "missing_only_released", "only_filter_missing", "delete_below_minimum", "ignore_ids", "ignore_imdb_ids",
"server_preroll", "changes_webhooks", "minimum_items", "cache_builders", "default_percent" "server_preroll", "changes_webhooks", "minimum_items", "cache_builders", "default_percent"
] + custom_sort_builders + summary_details + poster_details + radarr_details + sonarr_details ] + 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: if self.obj and self.only_run_on_create:
raise NotScheduled("Skipped because only_run_on_create is True and the collection already exists") 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("")
logger.debug("Validating Method: allowed_library_types") logger.debug("Validating Method: run_definition")
if self.data[methods["allowed_library_types"]] is None: if self.data[methods["run_definition"]] is None:
raise NotScheduled("Skipped because allowed_library_types has no library types") raise NotScheduled("Skipped because run_definition has no value")
logger.debug(f"Value: {self.data[methods['allowed_library_types']]}") logger.debug(f"Value: {self.data[methods['run_definition']]}")
found_type = False valid_options = ["true", "false"] + plex.library_types
for library_type in util.get_list(self.data[methods["allowed_library_types"]], lower=True): for library_type in util.get_list(self.data[methods["run_definition"]], lower=True):
if library_type == "true" or (self.library and library_type == self.library.Plex.type): if library_type not in valid_options:
found_type = True raise Failed(f"{self.Type} Error: {library_type} is invalid. Options: true, false, {', '.join(plex.library_types)}")
elif library_type == "false": elif library_type == "false":
raise NotScheduled(f"Skipped because allowed_library_types is false") raise NotScheduled(f"Skipped because run_definition is false")
elif library_type not in plex.library_types: elif library_type != "true" and self.library and library_type != self.library.Plex.type:
raise Failed(f"{self.Type} Error: {library_type} is invalid. Options: {', '.join(plex.library_types)}") raise NotScheduled(f"Skipped because run_definition library_type: {library_type} doesn't match")
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}")
if self.playlist: self.builder_level = "item" if self.playlist: self.builder_level = "item"
elif self.library.is_show: self.builder_level = "show" elif self.library.is_show: self.builder_level = "show"

@ -535,7 +535,8 @@ def run_libraries(config):
for library_type in library_types: for library_type in library_types:
for item in library.get_all(builder_level=library_type): for item in library.get_all(builder_level=library_type):
try: 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: except NotFound:
logger.error(f"{item.title[:25]:<25} | Labels Failed to be Removed") 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] 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.notify_delete(e)
library.stats["deleted"] += 1 library.stats["deleted"] += 1
library.status[str(mapping_name)]["status"] = "Deleted Not Scheduled" library.status[str(mapping_name)]["status"] = "Deleted Not Scheduled"
elif str(e).startswith("Skipped because allowed_library_types"): elif str(e).startswith("Skipped because run_definition"):
library.status[str(mapping_name)]["status"] = "Skipped Invalid Library Type" library.status[str(mapping_name)]["status"] = "Skipped Run Definition"
else: else:
library.status[str(mapping_name)]["status"] = "Not Scheduled" library.status[str(mapping_name)]["status"] = "Not Scheduled"
except FilterFailed: except FilterFailed:

Loading…
Cancel
Save