[5] #754 add original_language type to dynamic_collections

This commit is contained in:
meisnate12 2022-03-08 11:56:48 -05:00
parent 4a6f63825f
commit 5471cf345c
3 changed files with 64 additions and 2 deletions

View file

@ -1 +1 @@
1.16.0-develop4 1.16.0-develop5

View file

@ -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_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) | ✅ | ✅ | ✅ | ❌ | ❌ | | [`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_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_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 | ✅ | ✅ | ✅ | ❌ | ❌ | | [`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 data: 10
``` ```
### Original Language
Create collections based on the TMDb original language associated with items in the library.
<table class="dualTable colwidths-auto align-default table">
<tr>
<th><code>type</code> Option</th>
<td><code>original_language</code></td>
</tr>
<tr>
<th><code>data</code> Value</th>
<td>Not Used</td>
</tr>
<tr>
<th>Keys</th>
<td><a href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">ISO 639-1 Code</a></td>
</tr>
<tr>
<th>Titles</th>
<td>ISO Language Name</td>
</tr>
<tr>
<th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr>
<tr>
<th>Default Template</th>
<td>
```yaml
default_template:
plex_all: true
filters:
original_language: <<original_language>>
```
</td>
</tr>
</table>
#### 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 ### Trakt User Lists
Create collections for each of the Trakt lists for the specified users. Use `me` to reference the authenticated user. Create collections for each of the Trakt lists for the specified users. Use `me` to reference the authenticated user.

View file

@ -10,7 +10,7 @@ logger = util.logger
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/" github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
all_auto = ["genre"] 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 = { auto = {
"Movie": ["tmdb_collection", "decade", "country"] + all_auto + ms_auto, "Movie": ["tmdb_collection", "decade", "country"] + all_auto + ms_auto,
"Show": ["network"] + all_auto + ms_auto, "Show": ["network"] + all_auto + ms_auto,
@ -19,6 +19,7 @@ auto = {
} }
default_templates = { default_templates = {
"actor": {"tmdb_person": f"<<actor>>", "plex_search": {"all": {"actor": "tmdb"}}}, "actor": {"tmdb_person": f"<<actor>>", "plex_search": {"all": {"actor": "tmdb"}}},
"original_language": {"plex_all": True, "filters": {"original_language": "<<original_language>>"}},
"tmdb_collection": {"tmdb_collection_details": "<<tmdb_collection>>"}, "tmdb_collection": {"tmdb_collection_details": "<<tmdb_collection>>"},
"trakt_user_lists": {"trakt_list_details": "<<trakt_user_lists>>"}, "trakt_user_lists": {"trakt_list_details": "<<trakt_user_lists>>"},
"trakt_liked_lists": {"trakt_list_details": "<<trakt_liked_lists>>"}, "trakt_liked_lists": {"trakt_list_details": "<<trakt_liked_lists>>"},
@ -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: 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 auto_list[tmdb_item.collection.id] = tmdb_item.collection.name
logger.exorcise() 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 = "<<title>> <<library_type>>s"
elif auto_type == "actor": elif auto_type == "actor":
people = {} people = {}
if "data" in methods: if "data" in methods: