[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>>
sort_by: release.desc
sort_by_<<key>>: <<sort_by>>
allowed_library_types:
run_definition:
- <<use_<<key>>>>
- <<allowed_libraries>>
- <<allowed_streaming>>

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

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

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

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

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

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

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

@ -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"

@ -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:

Loading…
Cancel
Save