[8] dynamic actor fix

This commit is contained in:
meisnate12 2022-04-05 16:38:53 -04:00
parent d4b7819539
commit 3ad0e79c9a
5 changed files with 59 additions and 43 deletions

View file

@ -1 +1 @@
1.16.3-develop7 1.16.3-develop8

View file

@ -39,7 +39,7 @@ The default `sort_by` when it's not specified is `score.desc`.
### Sort Options ### Sort Options
| Option | Description | | Option | Description |
|:----------------------------------------|:-------------------------| |:----------------------------------------|:------------------------------|
| `score.asc`<br>`score.desc` | Sort by MdbList Score | | `score.asc`<br>`score.desc` | Sort by MdbList Score |
| `released.asc`<br>`released.desc` | Sort by Release Date | | `released.asc`<br>`released.desc` | Sort by Release Date |
| `imdbrating.asc`<br>`imdbrating.desc` | Sort by IMDb Rating | | `imdbrating.asc`<br>`imdbrating.desc` | Sort by IMDb Rating |
@ -47,6 +47,9 @@ The default `sort_by` when it's not specified is `score.desc`.
| `imdbpopular.asc`<br>`imdbpopular.desc` | Sort by IMDb Popular | | `imdbpopular.asc`<br>`imdbpopular.desc` | Sort by IMDb Popular |
| `tmdbpopular.asc`<br>`tmdbpopular.desc` | Sort by TMDb Popular | | `tmdbpopular.asc`<br>`tmdbpopular.desc` | Sort by TMDb Popular |
| `rogerebert.asc`<br>`rogerebert.desc` | Sort by RogerEvert Score | | `rogerebert.asc`<br>`rogerebert.desc` | Sort by RogerEvert Score |
| `rtomatoes.asc`<br>`rtomatoes.desc` | Sort by Rotten Tomatoes Score |
| `metacritic.asc`<br>`metacritic.desc` | Sort by Metacritic Score |
| `myanimelist.asc`<br>`myanimelist.desc` | Sort by MyAnimeList Score |
| `budget.asc`<br>`budget.desc` | Sort by Budget | | `budget.asc`<br>`budget.desc` | Sort by Budget |
| `revenue.asc`<br>`revenue.desc` | Sort by Revenue | | `revenue.asc`<br>`revenue.desc` | Sort by Revenue |
| `added.asc`<br>`added.desc` | Sort by Date Added | | `added.asc`<br>`added.desc` | Sort by Date Added |

View file

@ -88,6 +88,7 @@ dynamic_collections:
| [`addons`](#addons) | Defines how multiple keys can be combined under a parent key. | &#10060; | | [`addons`](#addons) | Defines how multiple keys can be combined under a parent key. | &#10060; |
| [`template`](#template) | Name of the template to use for these dynamic collections. | &#10060; | | [`template`](#template) | Name of the template to use for these dynamic collections. | &#10060; |
| [`template_variables`](#template-variables) | Defines how template variables can be defined by key. | &#10060; | | [`template_variables`](#template-variables) | Defines how template variables can be defined by key. | &#10060; |
| [`other_template`](#other-template) | Name of the template to use for the other collection. | &#10060; |
| [`remove_suffix`](#remove-prefixsuffix) | Removes the defined suffixes from the key before it's used in the collection title. | &#10060; | | [`remove_suffix`](#remove-prefixsuffix) | Removes the defined suffixes from the key before it's used in the collection title. | &#10060; |
| [`remove_prefix`](#remove-prefixsuffix) | Removes the defined prefixes from the key before it's used in the collection title. | &#10060; | | [`remove_prefix`](#remove-prefixsuffix) | Removes the defined prefixes from the key before it's used in the collection title. | &#10060; |
| [`title_format`](#title-format) | This is the format for the collection titles. | &#10060; | | [`title_format`](#title-format) | This is the format for the collection titles. | &#10060; |
@ -513,11 +514,11 @@ Create a collection for each actor found in the library.
</tr> </tr>
<tr> <tr>
<th>Keys</th> <th>Keys</th>
<td>TMDb Person ID</td> <td>Person Name</td>
</tr> </tr>
<tr> <tr>
<th>Key Names</th> <th>Key Names</th>
<td>TMDb Person Name</td> <td>Person Name</td>
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
@ -529,10 +530,9 @@ Create a collection for each actor found in the library.
```yaml ```yaml
default_template: default_template:
tmdb_person: <<value>>
plex_search: plex_search:
all: any:
actor: tmdb actor: <<value>>
``` ```
</td> </td>
@ -607,11 +607,11 @@ Create a collection for each director found in the library.
</tr> </tr>
<tr> <tr>
<th>Keys</th> <th>Keys</th>
<td>TMDb Person ID</td> <td>Person Name</td>
</tr> </tr>
<tr> <tr>
<th>Key Names</th> <th>Key Names</th>
<td>TMDb Person Name</td> <td>Person Name</td>
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
@ -623,10 +623,9 @@ Create a collection for each director found in the library.
```yaml ```yaml
default_template: default_template:
tmdb_person: <<value>>
plex_search: plex_search:
all: any:
director: tmdb director: <<value>>
``` ```
</td> </td>
@ -701,11 +700,11 @@ Create a collection for each writer found in the library.
</tr> </tr>
<tr> <tr>
<th>Keys</th> <th>Keys</th>
<td>TMDb Person ID</td> <td>Person Name</td>
</tr> </tr>
<tr> <tr>
<th>Key Names</th> <th>Key Names</th>
<td>TMDb Person Name</td> <td>Person Name</td>
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
@ -717,10 +716,9 @@ Create a collection for each writer found in the library.
```yaml ```yaml
default_template: default_template:
tmdb_person: <<value>>
plex_search: plex_search:
all: any:
writer: tmdb writer: <<value>>
``` ```
</td> </td>
@ -795,11 +793,11 @@ Create a collection for each producer found in the library.
</tr> </tr>
<tr> <tr>
<th>Keys</th> <th>Keys</th>
<td>TMDb Person ID</td> <td>Person Name</td>
</tr> </tr>
<tr> <tr>
<th>Key Names</th> <th>Key Names</th>
<td>TMDb Person Name</td> <td>Person Name</td>
</tr> </tr>
<tr> <tr>
<th>Default <code>title_format</code></th> <th>Default <code>title_format</code></th>
@ -811,10 +809,9 @@ Create a collection for each producer found in the library.
```yaml ```yaml
default_template: default_template:
tmdb_person: <<value>>
plex_search: plex_search:
all: all:
producer: tmdb producer: <<value>>
``` ```
</td> </td>
@ -1646,6 +1643,17 @@ dynamic_collections:
531241: https://www.themoviedb.org/t/p/original/nogV4th2P5QWYvQIMiWHj4CFLU9.jpg 531241: https://www.themoviedb.org/t/p/original/nogV4th2P5QWYvQIMiWHj4CFLU9.jpg
``` ```
## Other Template
Name of the template to use for the other collection. Will use the same template as the rest of the dynamic collections unless specified.
Each template is passed a few template variables you can use.
* `value`: The list of keys and addons
* `key`: The dynamic key
* `key_name`: The key after `key_name_override`, `remove_prefix`, or `remove_suffix` are run on it.
* `included_keys`: The list of included keys
* `used_keys`: The list of all keys used (included_keys and their addon keys)
## Remove Prefix/Suffix ## Remove Prefix/Suffix
Removes the defined prefixes/suffixes from the key before its used in the collection title. Removes the defined prefixes/suffixes from the key before its used in the collection title.

View file

@ -16,7 +16,7 @@ collections:
Then you add another: Then you add another:
``` ```yaml
collections: collections:
Bruce Lee: Bruce Lee:
actor: tmdb actor: tmdb
@ -52,14 +52,6 @@ The only things that change are the ID that is used with `tmdb_person` and the n
Those two things surrounded by `<< >>` are "template variables" that you can define for any collection using this template, like this: Those two things surrounded by `<< >>` are "template variables" that you can define for any collection using this template, like this:
```yaml
collections:
Bruce Lee:
template: {name: Actor, person: 19429}
```
or as a list:
```yaml ```yaml
collections: collections:
Chris Pratt: Chris Pratt:
@ -68,7 +60,15 @@ collections:
person: 73457 person: 73457
``` ```
Note that we provide the template name ["Actor"] and the value to insert in the place of `<<person>>`. The `<<collection_name>>` is a required property of a collection, so it is always available and doesn't have to be called out like `<<person>>`. or to do it in a single line you can do this
```yaml
collections:
Bruce Lee:
template: {name: Actor, person: 19429}
```
Note that we provide the template name `Actor` and the value to insert in the place of `<<person>>`. The `<<collection_name>>` is a template variable that is always available and doesn't have to be called out like `<<person>>`.
Inside a template, you can use all the Builders, Details, and [Filters](filters) attributes that you can give collections/playlists [except `template`; templates cannot be nested]. Inside a template, you can use all the Builders, Details, and [Filters](filters) attributes that you can give collections/playlists [except `template`; templates cannot be nested].
@ -95,13 +95,17 @@ collections:
person: 73457 person: 73457
``` ```
There are three attributes unique to `templates`, `default`, `optional`, and `move_prefix`. There are three attributes unique to `templates`; `default`, `optional`, and `move_prefix`.
* `default` can set default values for template variables to be used if they're not specified in the call. * `default` can set default values for template variables to be used if they're not specified in the call.
* `optional` can specify variables that if not specified on the template call will cause any attribute using one of those variables to be ignored in the template. You can make any template variable optional per collection by setting it to `null`. * `optional` can specify variables that if not specified on the template call will cause any attribute using one of those variables to be ignored in the template. You can make any template variable optional per collection by setting it to `null`.
* `move_prefix` can be given a list or comma-separated string of prefixes to move to the end of the collection/playlist name for sorting. * `move_prefix` can be given a list or comma-separated string of prefixes to move to the end of the collection/playlist name for sorting.
i.e. If you have `move_prefix: The` and a collection is called `The Avengers` then `<<collection_name>>` is replaced with `Avengers, The` instead of `The Avengers` for that collection. i.e. If you have `move_prefix: The` and a collection is called `The Avengers` then `<<collection_name>>` is replaced with `Avengers, The` instead of `The Avengers` for that collection.
Every template call is given either `<<collection_name>>` or `<<playlist_name>>` and `<<library_type>>` as template variables.
All Template Variables can append `_encoded` to the variable name to use a URL encode version of the variable. ex. `<<collection_name_encoded>>`
Here's an example IMDb Genre template and two different ways to call it. Here's an example IMDb Genre template and two different ways to call it.
```yaml ```yaml

View file

@ -408,6 +408,7 @@ class MetadataFile(DataFile):
for role in roles: for role in roles:
if person_count < person_limit and role["count"] > person_minimum and role["name"] not in exclude: if person_count < person_limit and role["count"] > person_minimum and role["name"] not in exclude:
auto_list[role["name"]] = role["name"] auto_list[role["name"]] = role["name"]
all_keys.append(role["name"])
person_count += 1 person_count += 1
default_template = {"plex_search": {"any": {auto_type: "<<value>>"}}} default_template = {"plex_search": {"any": {auto_type: "<<value>>"}}}
elif auto_type == "trakt_user_lists": elif auto_type == "trakt_user_lists":