From d44a672d662eae5948029c57812e4bb627415d0c Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 25 Mar 2022 18:42:03 -0400 Subject: [PATCH] [31] #801 add resolution, subtitle_language, and audio_language dynamic collection types --- VERSION | 2 +- docs/metadata/dynamic.md | 69 ++++++++++++++++++++++++++++++++++++++-- modules/meta.py | 15 +++++---- 3 files changed, 76 insertions(+), 10 deletions(-) diff --git a/VERSION b/VERSION index 3ed66878..714868f8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.2-develop30 +1.16.2-develop31 diff --git a/docs/metadata/dynamic.md b/docs/metadata/dynamic.md index 70c32f04..9e21c1cc 100644 --- a/docs/metadata/dynamic.md +++ b/docs/metadata/dynamic.md @@ -122,9 +122,10 @@ Depending on the `type` of dynamic collection, `data` is used to specify the opt | [`year`](#year) | Create a collection for each year found in the library | ❌ | ✅ | ✅ | ❌ | ❌ | | [`decade`](#decade) | Create a collection for each decade found in the library | ❌ | ✅ | ❌ | ❌ | ❌ | | [`country`](#country) | Create a collection for each country found in the library | ❌ | ✅ | ❌ | ✅ | ✅ | -| [`resolution`](#resolution) | Create a collection for each resolution found in the library | ❌ | ✅ | ❌ | ❌ | ❌ | -| [`subtitle_language`](#subtitle-language) | Create a collection for each subtitle language found in the library | ❌ | ✅ | ❌ | ❌ | ❌ | -| [`audio_language`](#audio-language) | Create a collection for each audio language found in the library | ❌ | ✅ | ❌ | ❌ | ❌ | +| [`resolution`](#resolution) | Create a collection for each resolution found in the library | ❌ | ✅ | ✅ | ❌ | ❌ | +| [`subtitle_language`](#subtitle-language) | Create a collection for each subtitle language found in the library | ❌ | ✅ | ✅ | ❌ | ❌ | +| [`audio_language`](#audio-language) | Create a collection for each audio language found in the library | ❌ | ✅ | ✅ | ❌ | ❌ | +| [`studio`](#studio) | Create a collection for each studio found in the library | ❌ | ✅ | ✅ | ❌ | ❌ | | [`network`](#network) | Create a collection for each network found in the library | ❌ | ❌ | ✅ | ❌ | ❌ | | [`mood`](#mood) | Create a collection for each mood found in the library | ❌ | ❌ | ❌ | ✅ | ❌ | | [`style`](#style) | Create a collection for each style found in the library | ❌ | ❌ | ❌ | ✅ | ❌ | @@ -161,6 +162,7 @@ Create collections based on the TMDb Collections associated with items in the li ```yaml default_template: tmdb_collection_details: <> + minimum_items: 2 ``` @@ -1315,6 +1317,67 @@ dynamic_collections: type: audio_language ``` +### Studio + +Create a collection for each studio found in the library. + + + + + + + + + + + + + + + + + + + + + + + + + + +
type Optionstudio
data ValueNot Used
KeysStudio
Key NamesStudio
Default title_formatTop <<key_name>> <<library_type>>s
Default Template + +```yaml +default_template: + smart_filter: + limit: 50 + sort_by: critic_rating.desc + any: + studio: <> +``` + +
+ + +#### Example: + +* Create a collection for each studio found in a Movies library + +```yaml +templates: + studio collection: + smart_filter: + sort_by: critic_rating.desc + all: + studio: <> +dynamic_collections: + Studios: # mapping name does not matter just needs to be unique + type: studio + title_format: <> + template: studio collection +``` + ### Network Create a collection for each network found in the library. diff --git a/modules/meta.py b/modules/meta.py index 04f89a19..3d90ccf2 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -12,11 +12,11 @@ github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Co all_auto = ["genre"] ms_auto = [ - "actor", "year", "content_rating", "original_language", "tmdb_popular_people", - "trakt_user_lists", "trakt_liked_lists", "trakt_people_list" + "actor", "year", "content_rating", "original_language", "tmdb_popular_people", "trakt_user_lists", + "trakt_liked_lists", "trakt_people_list", "subtitle_language", "audio_language", "resolution" ] auto = { - "Movie": ["tmdb_collection", "decade", "country", "director", "producer", "writer", "subtitle_language", "audio_language", "resolution"] + all_auto + ms_auto, + "Movie": ["tmdb_collection", "decade", "country", "director", "producer", "writer"] + all_auto + ms_auto, "Show": ["network", "origin_country"] + all_auto + ms_auto, "Artist": ["mood", "style", "country"] + all_auto, "Video": ["country", "content_rating"] + all_auto @@ -25,7 +25,7 @@ auto_type_translation = {"content_rating": "contentRating", "subtitle_language": default_templates = { "original_language": {"plex_all": True, "filters": {"original_language": "<>"}}, "origin_country": {"plex_all": True, "filters": {"origin_country": "<>"}}, - "tmdb_collection": {"tmdb_collection_details": "<>"}, + "tmdb_collection": {"tmdb_collection_details": "<>", "minimum_items": 2}, "trakt_user_lists": {"trakt_list_details": "<>"}, "trakt_liked_lists": {"trakt_list_details": "<>"}, "tmdb_popular_people": {"tmdb_person": f"<>", "plex_search": {"all": {"actor": "tmdb"}}}, @@ -285,9 +285,12 @@ class MetadataFile(DataFile): all_keys.append(ck) if ck not in exclude and cv not in exclude: auto_list[ck] = cv - if auto_type in ["genre", "mood", "style", "country", "network", "year", "decade", "content_rating", "subtitle_language", "audio_language", "resolution"]: + if auto_type in ["genre", "mood", "style", "country", "studio", "network", "year", "decade", "content_rating", "subtitle_language", "audio_language", "resolution"]: search_tag = auto_type_translation[auto_type] if auto_type in auto_type_translation else auto_type - tags = library.get_tags(search_tag) + if library.is_show and auto_type in ["resolution", "subtitle_language", "audio_language"]: + tags = library.get_tags(f"episode.{search_tag}") + else: + tags = library.get_tags(search_tag) if auto_type in ["decade", "subtitle_language", "audio_language"]: all_keys = [str(i.key) for i in tags] auto_list = {str(i.key): i.title for i in tags if str(i.title) not in exclude and str(i.key) not in exclude}