[11] rename the template variable to value among other fixes

pull/811/head
meisnate12 3 years ago
parent 06336caef4
commit 557a1da829

@ -14,8 +14,9 @@ jobs:
- name: Send Discord Release Notification - name: Send Discord Release Notification
uses: meisnate12/discord-notifications@master uses: meisnate12/discord-notifications@master
with: with:
webhook_id: ${{ secrets.BUILD_WEBHOOK_ID }} webhook_id: ${{ secrets.DEVELOP_WEBHOOK_ID }}
webhook_token: ${{ secrets.BUILD_WEBHOOK_TOKEN }} webhook_token: ${{ secrets.DEVELOP_WEBHOOK_TOKEN }}
title: Plex Meta Manager Develop Commit title: Plex Meta Manager Develop Push
commits: "true"
username: PMM Develop username: PMM Develop
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/pmm.png avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/pmm.png

@ -1 +1 @@
1.16.2-develop10 1.16.2-develop11

@ -59,7 +59,7 @@ dynamic_collections:
dynamic_collections: dynamic_collections:
Countries: # mapping name does not matter, just needs to be unique Countries: # mapping name does not matter, just needs to be unique
type: country type: country
title_format: <<country>> Cinema title_format: <<key_name>> Cinema
key_name_override: key_name_override:
France: French France: French
``` ```
@ -152,7 +152,7 @@ Create collections based on the TMDb Collections associated with items in the li
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -160,7 +160,7 @@ Create collections based on the TMDb Collections associated with items in the li
```yaml ```yaml
default_template: default_template:
tmdb_collection_details: <<tmdb_collection>> tmdb_collection_details: <<value>>
``` ```
</td> </td>
@ -200,7 +200,7 @@ Create collections based on each actor found on [TMDb's Popular People List](htt
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -208,7 +208,7 @@ Create collections based on each actor found on [TMDb's Popular People List](htt
```yaml ```yaml
default_template: default_template:
tmdb_person: <<tmdb_popular_people>> tmdb_person: <<value>>
plex_search: plex_search:
all: all:
actor: tmdb actor: tmdb
@ -250,7 +250,7 @@ Create collections based on the TMDb original language associated with items in
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td> <td><code>&lt;&lt;key_name&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -260,7 +260,7 @@ Create collections based on the TMDb original language associated with items in
default_template: default_template:
plex_all: true plex_all: true
filters: filters:
original_language: <<original_language>> original_language: <<value>>
``` ```
</td> </td>
@ -298,7 +298,7 @@ Create collections based on the TMDb origin country associated with items in the
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td> <td><code>&lt;&lt;key_name&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -308,7 +308,7 @@ Create collections based on the TMDb origin country associated with items in the
default_template: default_template:
plex_all: true plex_all: true
filters: filters:
origin_country: <<origin_country>> origin_country: <<value>>
``` ```
</td> </td>
@ -348,7 +348,7 @@ Create collections for each of the Trakt lists for the specified users. Use `me`
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -356,7 +356,7 @@ Create collections for each of the Trakt lists for the specified users. Use `me`
```yaml ```yaml
default_template: default_template:
trakt_list_details: <<trakt_user_lists>> trakt_list_details: <<value>>
``` ```
</td> </td>
@ -399,7 +399,7 @@ Create collections for each of the Trakt lists that the authenticated user has l
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -407,7 +407,7 @@ Create collections for each of the Trakt lists that the authenticated user has l
```yaml ```yaml
default_template: default_template:
trakt_list_details: <<trakt_liked_lists>> trakt_list_details: <<value>>
``` ```
</td> </td>
@ -447,7 +447,7 @@ Create collections for each of the people found within Trakt lists that the user
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -455,7 +455,7 @@ Create collections for each of the people found within Trakt lists that the user
```yaml ```yaml
default_template: default_template:
tmdb_person: <<trakt_people_list>> tmdb_person: <<value>>
plex_search: plex_search:
all: all:
actor: tmdb actor: tmdb
@ -519,7 +519,7 @@ Create a collection for each actor found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -527,7 +527,7 @@ Create a collection for each actor found in the library.
```yaml ```yaml
default_template: default_template:
tmdb_person: <<actor>> tmdb_person: <<value>>
plex_search: plex_search:
all: all:
actor: tmdb actor: tmdb
@ -613,7 +613,7 @@ Create a collection for each director found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -621,7 +621,7 @@ Create a collection for each director found in the library.
```yaml ```yaml
default_template: default_template:
tmdb_person: <<director>> tmdb_person: <<value>>
plex_search: plex_search:
all: all:
director: tmdb director: tmdb
@ -707,7 +707,7 @@ Create a collection for each writer found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -715,7 +715,7 @@ Create a collection for each writer found in the library.
```yaml ```yaml
default_template: default_template:
tmdb_person: <<writer>> tmdb_person: <<value>>
plex_search: plex_search:
all: all:
writer: tmdb writer: tmdb
@ -801,7 +801,7 @@ Create a collection for each producer found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>&lt;&lt;title&gt;&gt;</code></td> <td><code>&lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -809,7 +809,7 @@ Create a collection for each producer found in the library.
```yaml ```yaml
default_template: default_template:
tmdb_person: <<producer>> tmdb_person: <<value>>
plex_search: plex_search:
all: all:
producer: tmdb producer: tmdb
@ -873,7 +873,7 @@ Create a collection for each genre found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>Top &lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td> <td><code>Top &lt;&lt;key_name&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -885,7 +885,7 @@ default_template:
limit: 50 limit: 50
sort_by: critic_rating.desc sort_by: critic_rating.desc
any: any:
genre: <<genre>> genre: <<value>>
``` ```
</td> </td>
@ -906,7 +906,7 @@ templates:
limit: 100 limit: 100
sort_by: critic_rating.desc sort_by: critic_rating.desc
all: all:
genre: <<genre>> genre: <<value>>
dynamic_collections: dynamic_collections:
Genres: # mapping name does not matter just needs to be unique Genres: # mapping name does not matter just needs to be unique
type: genre type: genre
@ -939,7 +939,7 @@ Create a collection for each content rating found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>Top &lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td> <td><code>Top &lt;&lt;key_name&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -951,7 +951,7 @@ default_template:
limit: 50 limit: 50
sort_by: critic_rating.desc sort_by: critic_rating.desc
any: any:
content_rating: <<content_rating>> content_rating: <<value>>
``` ```
</td> </td>
@ -970,7 +970,7 @@ templates:
limit: 100 limit: 100
sort_by: critic_rating.desc sort_by: critic_rating.desc
all: all:
content_rating: <<content_rating>> content_rating: <<value>>
dynamic_collections: dynamic_collections:
Content Ratings: # mapping name does not matter just needs to be unique Content Ratings: # mapping name does not matter just needs to be unique
type: content_rating type: content_rating
@ -1000,7 +1000,7 @@ Create a collection for each year found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>Best &lt;&lt;library_type&gt;&gt;s of &lt;&lt;title&gt;&gt;</code></td> <td><code>Best &lt;&lt;library_type&gt;&gt;s of &lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -1012,7 +1012,7 @@ default_template:
limit: 50 limit: 50
sort_by: critic_rating.desc sort_by: critic_rating.desc
any: any:
year: <<year>> year: <<value>>
``` ```
</td> </td>
@ -1059,7 +1059,7 @@ Create a collection for each decade found in the library
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>Best &lt;&lt;library_type&gt;&gt;s of &lt;&lt;title&gt;&gt;</code></td> <td><code>Best &lt;&lt;library_type&gt;&gt;s of &lt;&lt;key_name&gt;&gt;</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -1071,7 +1071,7 @@ default_template:
limit: 50 limit: 50
sort_by: critic_rating.desc sort_by: critic_rating.desc
any: any:
decade: <<decade>> decade: <<value>>
``` ```
</td> </td>
@ -1116,7 +1116,7 @@ Create a collection for each country found in the library
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>Top &lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td> <td><code>Top &lt;&lt;key_name&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -1128,7 +1128,7 @@ default_template:
limit: 50 limit: 50
sort_by: critic_rating.desc sort_by: critic_rating.desc
any: any:
country: <<country>> country: <<value>>
``` ```
</td> </td>
@ -1187,7 +1187,7 @@ default_template:
limit: 50 limit: 50
sort_by: title.asc sort_by: title.asc
any: any:
resolution: <<resolution>> resolution: <<value>>
``` ```
</td> </td>
@ -1246,7 +1246,7 @@ default_template:
limit: 50 limit: 50
sort_by: critic_rating.asc sort_by: critic_rating.asc
any: any:
subtitle_language: <<subtitle_language>> subtitle_language: <<value>>
``` ```
</td> </td>
@ -1298,7 +1298,7 @@ default_template:
limit: 50 limit: 50
sort_by: critic_rating.asc sort_by: critic_rating.asc
any: any:
audio_language: <<audio_language>> audio_language: <<value>>
``` ```
</td> </td>
@ -1338,7 +1338,7 @@ Create a collection for each network found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>Top &lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td> <td><code>Top &lt;&lt;key_name&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -1350,7 +1350,7 @@ default_template:
limit: 50 limit: 50
sort_by: critic_rating.desc sort_by: critic_rating.desc
any: any:
network: <<network>> network: <<value>>
``` ```
</td> </td>
@ -1368,7 +1368,7 @@ templates:
smart_filter: smart_filter:
sort_by: critic_rating.desc sort_by: critic_rating.desc
all: all:
network: <<network>> network: <<value>>
dynamic_collections: dynamic_collections:
Networks: # mapping name does not matter just needs to be unique Networks: # mapping name does not matter just needs to be unique
type: network type: network
@ -1399,7 +1399,7 @@ Create a collection for each mood found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>Most Played &lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td> <td><code>Most Played &lt;&lt;value&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -1411,7 +1411,7 @@ default_template:
limit: 50 limit: 50
sort_by: plays.desc sort_by: plays.desc
any: any:
artist_mood: <<mood>> artist_mood: <<value>>
``` ```
</td> </td>
@ -1431,7 +1431,7 @@ templates:
sort_by: plays.desc sort_by: plays.desc
type: tracks type: tracks
all: all:
track_mood: <<mood>> track_mood: <<value>>
dynamic_collections: dynamic_collections:
Moods: # mapping name does not matter just needs to be unique Moods: # mapping name does not matter just needs to be unique
type: mood type: mood
@ -1462,7 +1462,7 @@ Create a collection for each style found in the library.
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
<td><code>Most Played &lt;&lt;title&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td> <td><code>Most Played &lt;&lt;key_name&gt;&gt; &lt;&lt;library_type&gt;&gt;s</code></td>
</tr> </tr>
<tr> <tr>
<th>Default Template</th> <th>Default Template</th>
@ -1474,7 +1474,7 @@ default_template:
limit: 50 limit: 50
sort_by: plays.desc sort_by: plays.desc
any: any:
artist_style: <<style>> artist_style: <<value>>
``` ```
</td> </td>
@ -1494,7 +1494,7 @@ templates:
sort_by: plays.desc sort_by: plays.desc
type: albums type: albums
all: all:
album_style: <<style>> album_style: <<value>>
dynamic_collections: dynamic_collections:
Styles: # mapping name does not matter just needs to be unique Styles: # mapping name does not matter just needs to be unique
type: style type: style
@ -1538,9 +1538,10 @@ dynamic_collections:
Name of the template to use for these dynamic collections. Each `type` has its own default template, but if you want to define and use your own template you can. Name of the template to use for these dynamic collections. Each `type` has its own default template, but if you want to define and use your own template you can.
Each template is passed a template variable whose name matches the dynamic collection `type`. i.e. in the example below `<<network>>` is the template variable. Each template is passed a few template variables you can use.
* `value`: The list of keys and addons
`key` and `key_name` are both passed along and can be used as template variables. * `key`: The dynamic key
* `key_name`: The key after `key_name_override`, `remove_prefix`, or `remove_suffix` are run on it.
For example, the template below removes the limit on the `smart_filter` so it shows all items in each network For example, the template below removes the limit on the `smart_filter` so it shows all items in each network
@ -1550,7 +1551,7 @@ templates:
smart_filter: smart_filter:
sort_by: critic_rating.desc sort_by: critic_rating.desc
all: all:
network: <<network>> network: <<value>>
dynamic_collections: dynamic_collections:
Networks: # mapping name does not matter just needs to be unique Networks: # mapping name does not matter just needs to be unique
type: network type: network
@ -1568,7 +1569,7 @@ For example, when using `type: tmdb_collections` and you want to define a poster
templates: templates:
optional: optional:
- my_collection_poster - my_collection_poster
tmdb_collection_details: <<collection_id>> tmdb_collection_details: <<value>>
collection_order: release collection_order: release
url_poster: <<my_collection_poster>> url_poster: <<my_collection_poster>>
dynamic_collections: dynamic_collections:

@ -132,7 +132,7 @@ class IMDb:
parental_dict = {} parental_dict = {}
expired = None expired = None
if self.config.Cache and not ignore_cache: if self.config.Cache and not ignore_cache:
parental_dict, expired = self.config.Cache.query_imdb_parental(imdb_id, self.config.expiration) parental_dict, expired = self.config.Cache.query_imdb_parental(imdb_id, self.config.Cache.expiration)
if parental_dict and expired is False: if parental_dict and expired is False:
return parental_dict return parental_dict
response = self.config.get_html(f"https://www.imdb.com/title/{imdb_id}/parentalguide") response = self.config.get_html(f"https://www.imdb.com/title/{imdb_id}/parentalguide")
@ -143,7 +143,7 @@ class IMDb:
else: else:
raise Failed(f"IMDb Error: No Item Found for IMDb ID: {imdb_id}") raise Failed(f"IMDb Error: No Item Found for IMDb ID: {imdb_id}")
if self.config.Cache and not ignore_cache: if self.config.Cache and not ignore_cache:
self.config.Cache.update_imdb_parental(expired, imdb_id, parental_dict, self.config.expiration) self.config.Cache.update_imdb_parental(expired, imdb_id, parental_dict, self.config.Cache.expiration)
return parental_dict return parental_dict
def _ids_from_chart(self, chart): def _ids_from_chart(self, chart):

@ -269,26 +269,31 @@ class MetadataFile(DataFile):
include = util.parse("Config", "include", dynamic, parent=map_name, methods=methods, datatype="list") if "include" in methods else [] include = util.parse("Config", "include", dynamic, parent=map_name, methods=methods, datatype="list") if "include" in methods else []
if og_exclude and include: if og_exclude and include:
raise Failed(f"Config Error: {map_name} cannot have both include and exclude attributes") raise Failed(f"Config Error: {map_name} cannot have both include and exclude attributes")
addons = util.parse("Config", "addons", dynamic, parent=map_name, methods=methods, datatype="dictlist") if "addons" in methods else {} addons = util.parse("Config", "addons", dynamic, parent=map_name, methods=methods, datatype="dictliststr") if "addons" in methods else {}
exclude = [str(e) for e in og_exclude] exclude = [str(e) for e in og_exclude]
for k, v in addons.items(): for k, v in addons.items():
if k in v: if k in v:
logger.warning(f"Config Warning: {k} cannot be an addon for itself") logger.warning(f"Config Warning: {k} cannot be an addon for itself")
exclude.extend([str(vv) for vv in v if str(vv) != str(k)]) exclude.extend([y for y in v if y != k])
default_title_format = "<<key_name>>" default_title_format = "<<key_name>>"
default_template = None default_template = None
auto_list = {} auto_list = {}
all_keys = []
dynamic_data = None dynamic_data = None
def _check_dict(check_dict): def _check_dict(check_dict):
for ck, cv in check_dict.items(): for ck, cv in check_dict.items():
all_keys.append(ck)
if ck not in exclude and cv not in exclude: if ck not in exclude and cv not in exclude:
auto_list[ck] = cv 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", "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 search_tag = auto_type_translation[auto_type] if auto_type in auto_type_translation else auto_type
tags = library.get_tags(search_tag)
if auto_type in ["decade", "subtitle_language", "audio_language"]: if auto_type in ["decade", "subtitle_language", "audio_language"]:
auto_list = {str(i.key): i.title for i in library.get_tags(search_tag) if str(i.title) not in exclude and str(i.key) not in exclude} 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}
else: else:
auto_list = {str(i.title): i.title for i in library.get_tags(search_tag) if str(i.title) not in exclude} all_keys = [str(i.title) for i in tags]
auto_list = {str(i.title): i.title for i in tags if str(i.title) not in exclude}
if library.is_music: if library.is_music:
default_template = {"smart_filter": {"limit": 50, "sort_by": "plays.desc", "any": {f"artist_{auto_type}": f"<<{auto_type}>>"}}} default_template = {"smart_filter": {"limit": 50, "sort_by": "plays.desc", "any": {f"artist_{auto_type}": f"<<{auto_type}>>"}}}
default_title_format = "Most Played <<key_name>> <<library_type>>s" default_title_format = "Most Played <<key_name>> <<library_type>>s"
@ -305,8 +310,10 @@ class MetadataFile(DataFile):
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}") logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
tmdb_id, tvdb_id, imdb_id = library.get_ids(item) 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) tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=True)
if tmdb_item and tmdb_item.collection_id and tmdb_item.collection_id not in exclude and tmdb_item.collection_name not in exclude: if tmdb_item and tmdb_item.collection_id:
auto_list[str(tmdb_item.collection_id)] = tmdb_item.collection_name all_keys.append(str(tmdb_item.collection_id))
if tmdb_item.collection_id not in exclude and tmdb_item.collection_name not in exclude:
auto_list[str(tmdb_item.collection_id)] = tmdb_item.collection_name
logger.exorcise() logger.exorcise()
elif auto_type == "original_language": elif auto_type == "original_language":
if not all_items: if not all_items:
@ -315,8 +322,10 @@ class MetadataFile(DataFile):
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}") logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
tmdb_id, tvdb_id, imdb_id = library.get_ids(item) 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=library.type == "Movie") tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=library.type == "Movie")
if tmdb_item and tmdb_item.language_iso and tmdb_item.language_iso not in exclude and tmdb_item.language_name not in exclude: if tmdb_item and tmdb_item.language_iso:
auto_list[tmdb_item.language_iso] = tmdb_item.language_name all_keys.append(tmdb_item.language_iso)
if tmdb_item.language_iso not in exclude and tmdb_item.language_name not in exclude:
auto_list[tmdb_item.language_iso] = tmdb_item.language_name
logger.exorcise() logger.exorcise()
default_title_format = "<<key_name>> <<library_type>>s" default_title_format = "<<key_name>> <<library_type>>s"
elif auto_type == "origin_country": elif auto_type == "origin_country":
@ -328,6 +337,7 @@ class MetadataFile(DataFile):
tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=library.type == "Movie") tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=library.type == "Movie")
if tmdb_item and tmdb_item.countries: if tmdb_item and tmdb_item.countries:
for country in tmdb_item.countries: for country in tmdb_item.countries:
all_keys.append(country.iso_3166_1)
if country.iso_3166_1 not in exclude and country.name not in exclude: if country.iso_3166_1 not in exclude and country.name not in exclude:
auto_list[country.iso_3166_1] = country.name auto_list[country.iso_3166_1] = country.name
logger.exorcise() logger.exorcise()
@ -457,9 +467,13 @@ class MetadataFile(DataFile):
for suffix in remove_suffix: for suffix in remove_suffix:
if key_name.endswith(suffix): if key_name.endswith(suffix):
key_name = key_name[:-len(suffix)].strip() key_name = key_name[:-len(suffix)].strip()
key_value = [key]
if key in addons:
key_value.extend([a for a in addons[key] if a in all_keys])
template_call = { template_call = {
"name": template_name, "name": template_name,
auto_type: [key] + addons[key] if key in addons else [key], "value": key_value,
auto_type: key_value,
"key_name": key_name, "key": key "key_name": key_name, "key": key
} }
for k, v in template_variables.items(): for k, v in template_variables.items():

@ -450,12 +450,14 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa
else: else:
raise Failed(f"{error} Error: {display} {dict_data} is not a dictionary") raise Failed(f"{error} Error: {display} {dict_data} is not a dictionary")
return final_list return final_list
elif datatype in ["dict", "dictlist", "dictdict", "strdict"]: elif datatype in ["dict", "dictlist", "dictdict", "strdict", "dictliststr"]:
if isinstance(value, dict): if isinstance(value, dict):
if datatype == "dict": if datatype == "dict":
return value return value
elif datatype == "dictlist": elif datatype == "dictlist":
return {k: v if isinstance(v, list) else [v] for k, v in value.items()} return {k: v if isinstance(v, list) else [v] for k, v in value.items()}
elif datatype == "dictliststr":
return {str(k): [str(y) for y in v] if isinstance(v, list) else [str(v)] for k, v in value.items()}
elif datatype == "strdict": elif datatype == "strdict":
return {str(k): str(v) for k, v in value.items()} return {str(k): str(v) for k, v in value.items()}
else: else:

Loading…
Cancel
Save