From 5471cf345c37ecf4f68fc2d3a35c6cc196723a35 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 8 Mar 2022 11:56:48 -0500 Subject: [PATCH] [5] #754 add original_language type to dynamic_collections --- VERSION | 2 +- docs/metadata/dynamic.md | 50 ++++++++++++++++++++++++++++++++++++++++ modules/meta.py | 14 ++++++++++- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index d2f0d39d..6306ddb9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.0-develop4 +1.16.0-develop5 diff --git a/docs/metadata/dynamic.md b/docs/metadata/dynamic.md index f9b241ed..3476920c 100644 --- a/docs/metadata/dynamic.md +++ b/docs/metadata/dynamic.md @@ -105,6 +105,7 @@ Depending on the `type` of dynamic collection, `data` is used to specify the opt |:----------------------------------------------|:------------------------------------------------------------------------------------------------------------|:--------------:|:--------:|:--------:|:--------:|:--------:| | [`tmdb_collection`](#tmdb-collection) | Create a collection for each TMDb Collection associated with an item in the library | ❌ | ✅ | ❌ | ❌ | ❌ | | [`tmdb_popular_people`](#tmdb-popular-people) | Create a collection for each actor found on [TMDb's Popular People List](https://www.themoviedb.org/person) | ✅ | ✅ | ✅ | ❌ | ❌ | +| [`original_language`](#original-language) | Create a collection for each TMDb original language associated with an item in the library | ❌ | ✅ | ✅ | ❌ | ❌ | | [`trakt_user_lists`](#trakt-user-lists) | Create a collection for each list from specific trakt users | ✅ | ✅ | ✅ | ❌ | ❌ | | [`trakt_liked_lists`](#trakt-liked-lists) | Create a collection for each list the authenticated trakt user likes | ❌ | ✅ | ✅ | ❌ | ❌ | | [`trakt_people_list`](#trakt-people-lists) | Create a collection for each actor found in the trakt list | ✅ | ✅ | ✅ | ❌ | ❌ | @@ -215,6 +216,55 @@ dynamic_collections: data: 10 ``` +### Original Language + +Create collections based on the TMDb original language associated with items in the library. + + + + + + + + + + + + + + + + + + + + + + + + + + +
type Optionoriginal_language
data ValueNot Used
KeysISO 639-1 Code
TitlesISO Language Name
Default title_format<<title>> <<library_type>>s
Default Template + +```yaml +default_template: + plex_all: true + filters: + original_language: <> +``` + +
+ +#### Example: Create collection for every TMDb Original Language found in the library. + +```yaml +dynamic_collections: + TMDb Languages: # This name is the mapping name + type: original_language +``` + + ### Trakt User Lists Create collections for each of the Trakt lists for the specified users. Use `me` to reference the authenticated user. diff --git a/modules/meta.py b/modules/meta.py index ba5bad34..86eea8b0 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -10,7 +10,7 @@ logger = util.logger github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/" all_auto = ["genre"] -ms_auto = ["actor", "year", "tmdb_popular_people", "trakt_user_lists", "trakt_liked_lists", "trakt_people_list"] +ms_auto = ["actor", "year", "original_language", "tmdb_popular_people", "trakt_user_lists", "trakt_liked_lists", "trakt_people_list"] auto = { "Movie": ["tmdb_collection", "decade", "country"] + all_auto + ms_auto, "Show": ["network"] + all_auto + ms_auto, @@ -19,6 +19,7 @@ auto = { } default_templates = { "actor": {"tmdb_person": f"<>", "plex_search": {"all": {"actor": "tmdb"}}}, + "original_language": {"plex_all": True, "filters": {"original_language": "<>"}}, "tmdb_collection": {"tmdb_collection_details": "<>"}, "trakt_user_lists": {"trakt_list_details": "<>"}, "trakt_liked_lists": {"trakt_list_details": "<>"}, @@ -285,6 +286,17 @@ class MetadataFile(DataFile): if tmdb_item and tmdb_item.collection and tmdb_item.collection.id not in exclude and tmdb_item.collection.name not in exclude: auto_list[tmdb_item.collection.id] = tmdb_item.collection.name logger.exorcise() + elif auto == "original_language": + if not all_items: + all_items = library.get_all() + for i, item in enumerate(all_items, 1): + logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}") + tmdb_id, tvdb_id, imdb_id = library.get_ids(item) + tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=True) + if tmdb_item and tmdb_item.original_language and tmdb_item.original_language.iso_639_1 not in exclude and tmdb_item.collection.english_name not in exclude: + auto_list[tmdb_item.collection.iso_639_1] = tmdb_item.collection.english_name + logger.exorcise() + default_title_format = "<> <<library_type>>s" elif auto_type == "actor": people = {} if "data" in methods: