[40] update how to match metadata definitions to items

pull/1404/head
meisnate12 2 years ago
parent 7f4d3e4a39
commit 07c7e58c37

@ -1 +1 @@
1.19.0-develop39
1.19.0-develop40

@ -90,82 +90,6 @@ dynamic_collections:
Plex Meta Manager can automatically update items in Plex [Movie](metadata/movie), [Show](metadata/show), and [Music](metadata/music) Libraries based on what's defined within the `metadata` attribute.
Each metadata requires its own section within the `metadata` attribute. Each item is defined by the mapping name which must be the same as the item name in the library unless an `alt_title` is specified.
```yaml
metadata:
Godzilla vs. Mechagodzilla II:
# ... details to change for this item
Godzilla vs. Megaguirus:
# ... details to change for this item
Godzilla vs. Megalon:
# ... details to change for this item
Halloween (Rob Zombie):
# ... details to change for this item
etc:
# ... details to change for this item
```
### Title, Year, & Edition
YAML files cannot have two items with the same mapping name so if you have two movies with the same name you define each one with a name of your choosing. Then use the `title` attribute to specify the real title and the `year` and/or `edition_filter` attribute to specify which of the multiple movies is for this mapping.
```yaml
metadata:
Godzilla1:
title: Godzilla
year: 1954
content_rating: R
Godzilla2:
title: Godzilla
year: 1998
content_rating: PG-13
Godzilla3:
title: Godzilla
year: 1954
edition_filter: Extended
content_rating: R
```
**Note: `edition_filter` only works with Movies**
### Alt Title
To define an alternative title that the item may be called when searching use `alt_title`. When a title is found matching `alt_title` then the name of the item will be changed to match the mapping name or `title` if specified.
For Example, the 2007 movie Halloween shares a name with another movie in the Halloween franchise so this changes the title to `Halloween (Rob Zombie)` if the title is currently Halloween.
```yaml
metadata:
Halloween (Rob Zombie):
alt_title: Halloween
year: 2007
```
### Example
```yaml
metadata:
Godzilla1:
title: Godzilla
year: 1954
content_rating: R
Godzilla2:
title: Godzilla
year: 1998
content_rating: PG-13
Godzilla vs. Mechagodzilla II:
content_rating: PG
Godzilla vs. Megaguirus:
content_rating: PG
originally_available: 2000-08-31
Godzilla vs. Megalon:
content_rating: G
originally_available: 1973-03-17
Halloween (Rob Zombie):
alt_title: Halloween
year: 2007
```
Each metadata requires its own section within the `metadata` attribute.
Each item is defined by the mapping name. Rules for how to match are on the Respective Library Metadata Pages.

@ -6,10 +6,12 @@ An example of multiple metadata edits in a movie library is below:
```yaml
metadata:
Godzilla (1954):
match:
title: Godzilla
year: 1954
content_rating: R
Godzilla (1998):
match:
title: Godzilla
year: 1998
sort_title: Godzilla 03
@ -68,32 +70,124 @@ metadata:
"Godzilla: Tokyo S.O.S.":
originally_available: 2003-12-14
Halloween (Rob Zombie):
alt_title: Halloween
match:
title:
- Halloween (Rob Zombie)
- Halloween
year: 2007
"Halo 4: Forward Unto Dawn":
alt_title: Halo 4 Forward Unto Dawn
match:
title:
- Halo 4: Forward Unto Dawn
- Halo 4 Forward Unto Dawn
tmdb_show: 56295
content_rating: R
```
## Movies
## Matching Movies
Each metadata definition is defined by the mapping name which can link to a movie in multiple ways.
The `match` attribute is used to match movies within Plex to that definition within the Metadata file. One definition can match and edit multiple movies. The available matching options are outlined below.
* Mapping name must match the movie name in Plex exactly unless an `alt_title` is specified.
* Mapping name must match the TMDb ID or IMDb ID mapped to the movie.
| Attribute | Description |
|:-------------------------------|:------------------------------------------------------------------------------------------------------------------|
| `title`<sup>1</sup> | Only matches movies that exactly match the movie's Title. Can be a list (only one needs to match). |
| `year` | Only matches movies that were released in the given year. |
| `mapping_id`<sup>2</sup> | Only matches movies that have the given TMDb or IMDb ID. |
| `edition`<sup>3</sup> | Only matches movies that exactly match the movie's Edition. Can be a list (only one needs to match). |
| `edition_contains`<sup>3</sup> | Only matches movies where the movie's Edition contains the given string. Can be a list (only one needs to match). |
| `blank_edition`<sup>3</sup> | Only matches movies that have no Edition.<br>**Default:** `false`<br>**Values:** `true` or `false` |
**Note:** to search for a movie titled with a number surround the number in quotes like in the example below.
1. When `title` is not provided and the mapping name was not specified as an ID, the default behaviour is to use the mapping name as `title` for matching.
2. When `mapping_id` is not provided and the mapping name was specified as an ID, the default behaviour is to use the mapping name as `mapping_id` for matching.
3. When the server does not have a Plex Pass then the Edition Field is not accessible. In this scenario, PMM will check the movie's filepath for `{edition-...}` to determine what the edition is.
### Examples
Below are some examples on how movies can be matched.
#### Example 1 - `title` and `mapping_id`
The below example shows how `title` and `mapping_id` can be used to match movies.
```yaml
metadata:
movie1: # Matches via the title "Star Wars"
match:
title: Star Wars
edits...
movie2: # Matches via TMDb ID: 299534
match:
mapping_id: 299534
edits...
movie3: # Matches via IMDb ID: tt4154756
match:
mapping_id: tt4154756
edits...
movie4: # Matches via the title "9"
match:
title: 9
edits...
```
The Mapping Name can also be used to reduce line-count, as shown here:
```yaml
metadata:
Star Wars: # Matches via the Name "Star Wars"
Star Wars: # Matches via the title "Star Wars"
edits...
299534: # Matches via TMDb ID: 299534
edits...
tt4154756: # Matches via IMDb ID: tt4154756
edits...
"9": # Matches via the Name "9"
"9": # Matches via the title "9"
edits...
```
**Note:** to search for a movie titled with a number from the mapping name you must surround the number in quotes like in the example below. Otherwise, it will look for the movie associated with that TMDb ID.
#### Example 2 - `title` and `year`
The below example shows how `title` and `year` can be used to match movies.
In this example, there are two movies in the library called "Godzilla", so the `year` attribute is used to identify which movie is being matched.
```yaml
metadata:
Godzilla (1954): # Matches via the title "Godzilla" released in 1954
match:
title: Godzilla
year: 1954
edits...
Godzilla (1998): # Matches via the title "Godzilla" released in 1998
match:
title: Godzilla
year: 1998
edits...
```
#### Example 3 - using `editions`
The edition attributes can be used to further specify which version of a movie should be matched within Plex.
This can be combined with Example 1 as follows
```yaml
metadata:
movie1: # Matches via the title "Star Wars" and edition containing "4K77"
match:
title: Star Wars
edition_contains: 4K77
edits...
```
If you wanted to specify the version of Star Wars which does not have an edition, then the `blank_edition` attribute can be used as shown below:
```yaml
metadata:
movie1: # Matches via the title "Star Wars" and checks for no edition version
match:
title: Star Wars
blank_edition: true
edits...
```
@ -103,16 +197,9 @@ The available attributes for editing movies are as follows
### Special Attributes
| Attribute | Allowed Values |
|:-------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `title` | Title if different from the mapping value useful when you have multiple movies with the same name. See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. |
| `alt_title` | Alternative title to look for and then change to the mapping name. See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. |
| `year` | Year of movie for better identification. See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. |
| `blank_edition`<sup>1</sup> | Movie has no Edition. See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. |
| `edition_filter`<sup>1</sup> | Edition of movie for better identification. Can be a list (only one needs to match). See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. |
| `edition_contains`<sup>1</sup> | Edition of movie must contain the given string for better identification. Can be a list (only one needs to match). See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. |
| `tmdb_show` | TMDb Show ID to use for metadata useful for miniseries that have been compiled into a movie. **This is not used to say this show is the given ID.** |
| `tmdb_movie` | TMDb Movie ID to use for metadata useful for movies that have been split into segments **This is not used to say this show is the given ID.** |
| Attribute | Description |
|:-----------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tmdb_show` | TMDb Show ID to use for metadata. Used when the Movie in your library is actually a miniseries on TMDb. (Example: [Halo 4: Forward Unto Dawn](https://www.themoviedb.org/tv/56295) or [IT](https://www.themoviedb.org/tv/19614)) **This is not used to say this movie is the given ID.** |
| `run_definition` | Used to specify if this definition runs.<br>Multiple can be used for one definition as a list or comma separated string. One `false` or unmatched library type will cause it to fail.<br>**Values:** `movie`, `show`, `artist`, `true`, `false` |
1. If the server does not have a Plex Pass then the Edition Field is not accessible. In this case PMM will check the movies filepath for `{edition-MOVIES EDITION}` to determine what the edition is.
@ -120,18 +207,19 @@ The available attributes for editing movies are as follows
### General Attributes
| Attribute | Allowed Values |
|:-----------------------|:--------------------------------------------------------------|
| `sort_title` | Text to change Sort Title |
| `edition` | Text to change Edition |
| `original_title` | Text to change Original Title |
| `originally_available` | Date to change Originally Available<br>**Format:** YYYY-MM-DD |
| `content_rating` | Text to change Content Rating |
| `user_rating` | Number to change User Rating |
| `audience_rating` | Number to change Audience Rating |
| `critic_rating` | Number to change Critic Rating |
| `studio` | Text to change Studio |
| `tagline` | Text to change Tagline |
| `summary` | Text to change Summary |
|:-----------------------|:---------------------------------------------------------------|
| `title` | Text to change Title. |
| `sort_title` | Text to change Sort Title. |
| `edition` | Text to change Edition. |
| `original_title` | Text to change Original Title. |
| `originally_available` | Date to change Originally Available.<br>**Format:** YYYY-MM-DD |
| `content_rating` | Text to change Content Rating. |
| `user_rating` | Number to change User Rating. |
| `audience_rating` | Number to change Audience Rating. |
| `critic_rating` | Number to change Critic Rating. |
| `studio` | Text to change Studio. |
| `tagline` | Text to change Tagline. |
| `summary` | Text to change Summary. |
### Tag Attributes
@ -140,29 +228,29 @@ You can add `.remove` to any tag attribute to only remove those tags i.e. `genre
You can add `.sync` to any tag attribute to sync all tags vs just appending the new ones i.e. `genre.sync`.
| Attribute | Allowed Values |
|:-------------|:----------------------------------------------------|
| `director` | List or comma-separated text of each Director Tag |
| `country` | List or comma-separated text of each Country Tag |
| `genre` | List or comma-separated text of each Genre Tag |
| `writer` | List or comma-separated text of each Writer Tag |
| `producer` | List or comma-separated text of each Producer Tag |
| `collection` | List or comma-separated text of each Collection Tag |
| `label` | List or comma-separated text of each Label Tag |
|:-------------|:-----------------------------------------------------|
| `director` | List or comma-separated text of each Director Tag. |
| `country` | List or comma-separated text of each Country Tag. |
| `genre` | List or comma-separated text of each Genre Tag. |
| `writer` | List or comma-separated text of each Writer Tag. |
| `producer` | List or comma-separated text of each Producer Tag. |
| `collection` | List or comma-separated text of each Collection Tag. |
| `label` | List or comma-separated text of each Label Tag. |
### Advanced Attributes
### Image Attributes
| Attribute | Allowed Values |
|:---------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `metadata_language` | `default`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` |
| `use_original_title` | `default`: Library default<br>`no`: No<br>`yes`: Yes |
|:------------------|:-------------------------------------------------|
| `url_poster` | URL of image publicly available on the internet. |
| `file_poster` | Path to image in the file system. |
| `url_background` | URL of image publicly available on the internet. |
| `file_background` | Path to image in the file system. |
\* Must be using the **New Plex Movie Agent*
### Advanced Attributes
### Image Attributes
| Attribute | Allowed Values |
|:---------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `metadata_language`<sup>1</sup> | `default`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` |
| `use_original_title`<sup>1</sup> | `default`: Library default<br>`no`: No<br>`yes`: Yes |
| Attribute | Description | Allowed Values |
|:------------------|:----------------------------------------------------------------------|:------------------------------------------------|
| `url_poster` | Used to change the movie's poster to the URL | URL of image publicly available on the internet |
| `file_poster` | Used to change the movie's poster to the image in the file system | Path to image in the file system |
| `url_background` | Use to change the movie's background to the URL | URL of image publicly available on the internet |
| `file_background` | Used to change the movie's background to the image in the file system | Path to image in the file system |
1. Must be using the **New Plex Movie Agent**.

@ -29,21 +29,47 @@ metadata:
originally_available: "2007-05-14"
```
## Artist
## Matching Artist
Each artist is defined by the mapping name which must be the same as the artist name in the library unless an `alt_title` is specified.
The `match` attribute is used to match artists within Plex to that definition within the Metadata file. One definition can match and edit multiple artists. The available matching options are outlined below.
### Albums
| Attribute | Allowed Values |
|:-------------------------------|:-----------------------------------------------------------------------------------------------------|
| `title`<sup>1</sup> | Only matches artists that exactly match the artist's Title. Can be a list (only one needs to match). |
To edit the metadata of a particular Album for an Artist use the `albums` attribute on its artist.
1. When `title` is not provided and the mapping name was not specified as an ID, the default behaviour is to use the mapping name as `title` for matching.
The mapping name is the album name.
### Examples
### Tracks
Below are some examples on how artists can be matched.
To edit the metadata of a particular Track on an Album use the `tracks` attribute on its album.
#### Example 1 - `title`
The mapping name is the track number on that Album, or the title of the Track.
The below example shows how `title` can be used to match artists.
```yaml
metadata:
artist1: # Matches via the title "Game of Thrones"
match:
title: Game of Thrones
edits...
artist2: # Matches via the title "24"
match:
title: 24
edits...
```
The Mapping Name can also be used to reduce line-count, as shown here:
```yaml
metadata:
Ke$ha: # Matches via the Name "Game of Thrones"
edits...
"311": # Matches via the Name "311"
edits...
```
**Note:** to search for an artist titled with a number from the mapping name you must surround the number in quotes like in the example below. Otherwise, it will look for the artist associated with that TVDb ID.
## Metadata Edits
@ -52,10 +78,9 @@ The available attributes for editing artists, albums, and tracks are as follows
### Special Attributes
| Attribute | Values | Artists | Album | Tracks |
|:------------|:------------------------------|:--------:|:--------:|:--------:|
| `alt_title` | Alternative title to look for | &#9989; | &#9989; | &#9989; |
| `albums` | Mapping to define Albums | &#9989; | &#10060; | &#10060; |
| `tracks` | Mapping to define Tracks | &#10060; | &#9989; | &#10060; |
|:------------|:----------------------------------------------------------------------------------------------------------------------|:--------:|:--------:|:--------:|
| `albums` | Attribute used to edit album metadata. The mapping name is the album name. | &#9989; | &#10060; | &#10060; |
| `tracks` | Attribute used to edit track metadata. The mapping name is the track number on that Album, or the title of the Track. | &#10060; | &#9989; | &#10060; |
* If you know of another Title your item might exist under, but you want it titled differently you can use `alt_title` to specify another title to look under and then be changed to the mapping name. For Example the Artist `Kesha` used to be stylized as `Ke$ha`, and might still be found that way in Metadata results.
```yaml
@ -69,16 +94,16 @@ The available attributes for editing artists, albums, and tracks are as follows
| Attribute | Values | Artists | Album | Tracks |
|:-----------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:--------:|:--------:|
| `title` | Text to change Title | &#10060; | &#10060; | &#9989; |
| `sort_title` | Text to change Sort Title | &#9989; | &#9989; | &#9989; |
| `user_rating` | Number to change User Rating | &#9989; | &#9989; | &#9989; |
| `critic_rating` | Number to change Critic Rating | &#10060; | &#9989; | &#10060; |
| `originally_available` | Date to change Originally Available<br>**Format:** YYYY-MM-DD | &#10060; | &#9989; | &#10060; |
| `record_label` | Text to change Record Label | &#10060; | &#9989; | &#10060; |
| `summary` | Text to change Summary | &#9989; | &#9989; | &#9989; |
| `track` | Text to change Track | &#10060; | &#10060; | &#9989; |
| `disc` | Text to change Disc | &#10060; | &#10060; | &#9989; |
| `original_artist` | Text to change Original Artist | &#10060; | &#10060; | &#9989; |
| `title` | Text to change Title. | &#10060; | &#10060; | &#9989; |
| `sort_title` | Text to change Sort Title. | &#9989; | &#9989; | &#9989; |
| `user_rating` | Number to change User Rating. | &#9989; | &#9989; | &#9989; |
| `critic_rating` | Number to change Critic Rating. | &#10060; | &#9989; | &#10060; |
| `originally_available` | Date to change Originally Available.<br>**Format:** YYYY-MM-DD | &#10060; | &#9989; | &#10060; |
| `record_label` | Text to change Record Label. | &#10060; | &#9989; | &#10060; |
| `summary` | Text to change Summary. | &#9989; | &#9989; | &#9989; |
| `track` | Text to change Track. | &#10060; | &#10060; | &#9989; |
| `disc` | Text to change Disc. | &#10060; | &#10060; | &#9989; |
| `original_artist` | Text to change Original Artist. | &#10060; | &#10060; | &#9989; |
| `run_definition` | Used to specify if this definition runs.<br>Multiple can be used for one definition as a list or comma separated string. One `false` or unmatched library type will cause it to fail.<br>**Values:** `movie`, `show`, `artist`, `true`, `false` | &#9989; | &#10060; | &#10060; |
### Tag Attributes
@ -88,23 +113,23 @@ You can add `.remove` to any tag attribute to only remove those tags i.e. `genre
You can add `.sync` to any tag attribute to sync all tags vs just appending the new ones i.e. `genre.sync`.
| Attribute | Values | Artists | Album | Tracks |
|:-----------------|:--------------------------------------------------------|:--------:|:--------:|:--------:|
| `genre` | List or comma-separated text of each Genre Tag | &#9989; | &#9989; | &#10060; |
| `collection` | List or comma-separated text of each Collection Tag | &#9989; | &#9989; | &#9989; |
| `label` | List or comma-separated text of each Label Tag | &#9989; | &#9989; | &#9989; |
| `style` | List or comma-separated text of each Style Tag | &#9989; | &#9989; | &#10060; |
| `mood` | List or comma-separated text of each Mood Tag | &#9989; | &#9989; | &#9989; |
| `country` | List or comma-separated text of each Country Tag | &#9989; | &#10060; | &#10060; |
| `similar_artist` | List or comma-separated text of each Similar Artist Tag | &#9989; | &#10060; | &#10060; |
|:-----------------|:---------------------------------------------------------|:--------:|:--------:|:--------:|
| `genre` | List or comma-separated text of each Genre Tag. | &#9989; | &#9989; | &#10060; |
| `collection` | List or comma-separated text of each Collection Tag. | &#9989; | &#9989; | &#9989; |
| `label` | List or comma-separated text of each Label Tag. | &#9989; | &#9989; | &#9989; |
| `style` | List or comma-separated text of each Style Tag. | &#9989; | &#9989; | &#10060; |
| `mood` | List or comma-separated text of each Mood Tag. | &#9989; | &#9989; | &#9989; |
| `country` | List or comma-separated text of each Country Tag. | &#9989; | &#10060; | &#10060; |
| `similar_artist` | List or comma-separated text of each Similar Artist Tag. | &#9989; | &#10060; | &#10060; |
### Image Attributes
| Attribute | Values | Artists | Album | Tracks |
|:------------------|:------------------------------------------------|:-------:|:-------:|:--------:|
| `url_poster` | URL of image publicly available on the internet | &#9989; | &#9989; | &#10060; |
| `file_poster` | Path to image in the file system | &#9989; | &#9989; | &#10060; |
| `url_background` | URL of image publicly available on the internet | &#9989; | &#9989; | &#10060; |
| `file_background` | Path to image in the file system | &#9989; | &#9989; | &#10060; |
|:------------------|:-------------------------------------------------|:-------:|:-------:|:--------:|
| `url_poster` | URL of image publicly available on the internet. | &#9989; | &#9989; | &#10060; |
| `file_poster` | Path to image in the file system. | &#9989; | &#9989; | &#10060; |
| `url_background` | URL of image publicly available on the internet. | &#9989; | &#9989; | &#10060; |
| `file_background` | Path to image in the file system. | &#9989; | &#9989; | &#10060; |
### Advanced Attributes

@ -43,8 +43,11 @@ metadata:
21:
summary: The Epic Series Final of Avatar The Last Airbender
"Avatar: The Legend of Korra":
match:
title:
- "Avatar: The Legend of Korra"
- The Legend of Korra
sort_title: Avatar 02
alt_title: The Legend of Korra
original_title: The Legend of Korra
seasons:
1:
@ -57,14 +60,48 @@ metadata:
title: "Book Four: Balance"
```
## Shows
## Matching Shows
Each metadata definition is defined by the mapping name which can link to a show in multiple ways.
The `match` attribute is used to match shows within Plex to that definition within the Metadata file. One definition can match and edit multiple shows. The available matching options are outlined below.
* Mapping name must match the show name in Plex exactly unless an `alt_title` is specified.
* Mapping name must match the TVDb ID or IMDb ID mapped to the show.
| Attribute | Allowed Values |
|:-------------------------------|:------------------------------------------------------------------------------------------------------------------|
| `title`<sup>1</sup> | Only matches shows that exactly match the show's Title. Can be a list (only one needs to match). |
| `year` | Only matches shows that were released in the given year. |
| `mapping_id`<sup>2</sup> | Only matches shows that have the given TVDb or IMDb ID. |
**Note:** to search for a show titled with a number surround the number in quotes like in the example below.
1. When `title` is not provided and the mapping name was not specified as an ID, the default behaviour is to use the mapping name as `title` for matching.
2. When `mapping_id` is not provided and the mapping name was specified as an ID, the default behaviour is to use the mapping name as `mapping_id` for matching.
### Examples
Below are some examples on how shows can be matched.
#### Example 1 - `title` and `mapping_id`
The below example shows how `title` and `mapping_id` can be used to match shows.
```yaml
metadata:
show1: # Matches via the title "Game of Thrones"
match:
title: Game of Thrones
edits...
show2: # Matches via TVDb ID: 366524
match:
mapping_id: 366524
edits...
show3: # Matches via IMDb ID: tt10234724
match:
mapping_id: tt10234724
edits...
show4: # Matches via the title "24"
match:
title: 24
edits...
```
The Mapping Name can also be used to reduce line-count, as shown here:
```yaml
metadata:
@ -78,17 +115,27 @@ metadata:
edits...
```
### Seasons
**Note:** to search for a show titled with a number from the mapping name you must surround the number in quotes like in the example below. Otherwise, it will look for the show associated with that TVDb ID.
To edit the metadata of a particular Season in a Show use the `seasons` attribute on its show.
#### Example 2 - `title` and `year`
The mapping name is the season number (use 0 for specials) or the season name.
The below example shows how `title` and `year` can be used to match shows.
### Episodes
In this example, there are two shows in the library called "Vikings", so the `year` attribute is used to identify which show is being matched.
To edit the metadata of a particular Episode in a Season use the `episodes` attribute on its season.
The mapping name is the episode number in that season, the title of the episode, or the Originally Available date in the format `MM/DD`.
```yaml
metadata:
Vikings (2012): # Matches via the title "Vikings" released in 2012
match:
title: Vikings
year: 2012
edits...
Vikings (2013): # Matches via the title "Vikings" released in 2013
match:
title: Vikings
year: 2013
edits...
```
## Metadata Edits
@ -96,37 +143,32 @@ The available attributes for editing shows, seasons, and episodes are as follows
### Special Attributes
| Attribute | Values | Shows | Seasons | Episodes |
| Attribute | Description | Shows | Seasons | Episodes |
|:------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:--------:|:--------:|
| `title` | Title if different from the mapping value useful when you have multiple shows with the same name. See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. | &#9989; | &#9989; | &#9989; |
| `alt_title` | Alternative title to look for and then change to the mapping name. See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. | &#9989; | &#10060; | &#10060; |
| `year` | Year of show for better identification. See the [Metadata Page](../metadata.md#metadata-attributes) for how searching for files works. | &#9989; | &#10060; | &#10060; |
| `tmdb_show` | TMDb Show ID to use for metadata useful for miniseries that have been compiled into a movie | &#9989; | &#10060; | &#10060; |
| `tmdb_movie` | TMDb Movie ID to use for metadata useful for movies that have been split into segments | &#9989; | &#10060; | &#10060; |
| `f1_season` | F1 Season Year to make the Show represent a Season of F1 Races. See [Formula 1 Metadata Guide](../../home/guides/formula) for more information. | &#9989; | &#10060; | &#10060; |
| `round_prefix` | Used only with `f1_season` to add the round as a prefix to the Season (Race) Titles i.e. `Australian Grand Prix` --> `01 - Australian Grand Prix` | &#9989; | &#10060; | &#10060; |
| `shorten_gp` | Used only with `f1_season` to shorten `Grand Prix` to `GP` in the Season (Race) Titles i.e. `Australian Grand Prix` --> `Australian GP` | &#9989; | &#10060; | &#10060; |
| `seasons` | Mapping to define Seasons | &#9989; | &#10060; | &#10060; |
| `episodes` | Mapping to define Episodes | &#10060; | &#9989; | &#10060; |
| `round_prefix` | Used only with `f1_season` to add the round as a prefix to the Season (Race) Titles i.e. `Australian Grand Prix` --> `01 - Australian Grand Prix`. | &#9989; | &#10060; | &#10060; |
| `shorten_gp` | Used only with `f1_season` to shorten `Grand Prix` to `GP` in the Season (Race) Titles i.e. `Australian Grand Prix` --> `Australian GP`. | &#9989; | &#10060; | &#10060; |
| `seasons` | Attribute used to edit season metadata. The mapping name is the season number (use 0 for specials) or the season name. | &#9989; | &#10060; | &#10060; |
| `episodes` | Attribute used to edit episode metadata. The mapping name is the episode number in that season, the title of the episode, or the Originally Available date in the format `MM/DD`. | &#10060; | &#9989; | &#10060; |
| `run_definition` | Used to specify if this definition runs.<br>Multiple can be used for one definition as a list or comma separated string. One `false` or unmatched library type will cause it to fail.<br>**Values:** `movie`, `show`, `artist`, `true`, `false` | &#9989; | &#10060; | &#10060; |
| `update_seasons` | Used to specify if this definition's seasons metadata will update.<br>Multiple can be used for one definition as a list or comma separated string. One `false` will cause it to fail.<br>**Values:** `true`, `false` | &#9989; | &#10060; | &#10060; |
| `update_episodes` | Used to specify if this definition's episodes metadata will update.<br>Multiple can be used for one definition as a list or comma separated string. One `false` will cause it to fail.<br>**Values:** `true`, `false` | &#9989; | &#10060; | &#10060; |
### General Attributes
| Attribute | Values | Shows | Seasons | Episodes |
|:-----------------------|:--------------------------------------------------------------|:--------:|:--------:|:--------:|
| `title` | Text to change Title | &#10060; | &#9989; | &#9989; |
| `sort_title` | Text to change Sort Title | &#9989; | &#10060; | &#9989; |
| `original_title` | Text to change Original Title | &#9989; | &#10060; | &#10060; |
| `originally_available` | Date to change Originally Available<br>**Format:** YYYY-MM-DD | &#9989; | &#10060; | &#9989; |
| `content_rating` | Text to change Content Rating | &#9989; | &#10060; | &#9989; |
| `user_rating` | Number to change User Rating | &#9989; | &#9989; | &#9989; |
| `audience_rating` | Number to change Audience Rating | &#9989; | &#10060; | &#9989; |
| `critic_rating` | Number to change Critic Rating | &#9989; | &#10060; | &#9989; |
| `studio` | Text to change Studio | &#9989; | &#10060; | &#10060; |
| `tagline` | Text to change Tagline | &#9989; | &#10060; | &#10060; |
| `summary` | Text to change Summary | &#9989; | &#9989; | &#9989; |
| Attribute | Allowed Values | Shows | Seasons | Episodes |
|:-----------------------|:---------------------------------------------------------------|:-------:|:--------:|:--------:|
| `title` | Text to change Title. | &#9989; | &#9989; | &#9989; |
| `sort_title` | Text to change Sort Title. | &#9989; | &#10060; | &#9989; |
| `original_title` | Text to change Original Title. | &#9989; | &#10060; | &#10060; |
| `originally_available` | Date to change Originally Available.<br>**Format:** YYYY-MM-DD | &#9989; | &#10060; | &#9989; |
| `content_rating` | Text to change Content Rating. | &#9989; | &#10060; | &#9989; |
| `user_rating` | Number to change User Rating. | &#9989; | &#9989; | &#9989; |
| `audience_rating` | Number to change Audience Rating. | &#9989; | &#10060; | &#9989; |
| `critic_rating` | Number to change Critic Rating. | &#9989; | &#10060; | &#9989; |
| `studio` | Text to change Studio. | &#9989; | &#10060; | &#10060; |
| `tagline` | Text to change Tagline. | &#9989; | &#10060; | &#10060; |
| `summary` | Text to change Summary. | &#9989; | &#9989; | &#9989; |
### Tag Attributes
@ -134,28 +176,28 @@ You can add `.remove` to any tag attribute to only remove those tags i.e. `genre
You can add `.sync` to any tag attribute to sync all tags vs just appending the new ones i.e. `genre.sync`.
| Attribute | Values | Shows | Seasons | Episodes |
|:-------------|:----------------------------------------------------|:--------:|:--------:|:--------:|
| `director` | List or comma-separated text of each Director Tag | &#10060; | &#10060; | &#9989; |
| `genre` | List or comma-separated text of each Genre Tag | &#9989; | &#10060; | &#10060; |
| `writer` | List or comma-separated text of each Writer Tag | &#10060; | &#10060; | &#9989; |
| `collection` | List or comma-separated text of each Collection Tag | &#9989; | &#9989; | &#9989; |
| `label` | List or comma-separated text of each Label Tag | &#9989; | &#9989; | &#9989; |
| Attribute | Allowed Values | Shows | Seasons | Episodes |
|:-------------|:-----------------------------------------------------|:--------:|:--------:|:--------:|
| `director` | List or comma-separated text of each Director Tag. | &#10060; | &#10060; | &#9989; |
| `genre` | List or comma-separated text of each Genre Tag. | &#9989; | &#10060; | &#10060; |
| `writer` | List or comma-separated text of each Writer Tag. | &#10060; | &#10060; | &#9989; |
| `collection` | List or comma-separated text of each Collection Tag. | &#9989; | &#9989; | &#9989; |
| `label` | List or comma-separated text of each Label Tag. | &#9989; | &#9989; | &#9989; |
### Image Attributes
| Attribute | Values | Shows | Seasons | Episodes |
|:------------------|:------------------------------------------------|:-------:|:-------:|:--------:|
| `url_poster` | URL of image publicly available on the internet | &#9989; | &#9989; | &#9989; |
| `file_poster` | Path to image in the file system | &#9989; | &#9989; | &#9989; |
| `url_background` | URL of image publicly available on the internet | &#9989; | &#9989; | &#9989; |
| `file_background` | Path to image in the file system | &#9989; | &#9989; | &#9989; |
| Attribute | Allowed Values | Shows | Seasons | Episodes |
|:------------------|:-------------------------------------------------|:-------:|:-------:|:--------:|
| `url_poster` | URL of image publicly available on the internet. | &#9989; | &#9989; | &#9989; |
| `file_poster` | Path to image in the file system. | &#9989; | &#9989; | &#9989; |
| `url_background` | URL of image publicly available on the internet. | &#9989; | &#9989; | &#9989; |
| `file_background` | Path to image in the file system. | &#9989; | &#9989; | &#9989; |
### Advanced Attributes
All these attributes only work with Shows.
| Attribute | Values |
| Attribute | Allowed Values |
|:---------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `episode_sorting` | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`oldest`</td><td>Oldest first</td></tr><tr><td>`newest`</td><td>Newest first</td></tr></tbody></table> |
| `keep_episodes` | <table class="clearTable"><tbody><tr><td>`all`</td><td>All episodes</td></tr><tr><td>`5_latest`</td><td>5 latest episodes</td></tr><tr><td>`3_latest`</td><td>3 latest episodes</td></tr><tr><td>`latest`</td><td>Latest episodes</td></tr><tr><td>`past_3`</td><td>Episodes added in the past 3 days</td></tr><tr><td>`past_7`</td><td>Episodes added in the past 7 days</td></tr><tr><td>`past_30`</td><td>Episodes added in the past 30 days</td></tr></tbody></table> |
@ -165,4 +207,4 @@ All these attributes only work with Shows.
| `metadata_language`<sup>1</sup> | `default`, `ar-SA`, `ca-ES`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-US`, `es-ES`, `es-MX`, `et-EE`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `lt-LT`, `lv-LV`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-HK`, `zh-TW` |
| `use_original_title`<sup>1</sup> | <table class="clearTable"><tbody><tr><td>`default`</td><td>Library default</td></tr><tr><td>`no`</td><td>No</td></tr><tr><td>`yes`</td><td>Yes</td></tr></tbody></table> |
<sup>1</sup> Must be using the **New Plex TV Agent**
1. Must be using the **New Plex TV Agent**

@ -1436,22 +1436,29 @@ class MetadataFile(DataFile):
elif library_type != "true" and self.library and library_type != self.library.Plex.type:
raise NotScheduled(f"Skipped because run_definition library_type: {library_type} doesn't match")
match_data = None
match_methods = {}
if "match" in methods:
logger.debug("")
logger.debug("Validating Method: match")
match_data = meta[methods["match"]]
match_methods = {mm.lower(): mm for mm in match_data}
mapping_id = None
if "mapping_id" in methods and not self.library.is_music:
item = []
if ("mapping_id" in match_methods or "mapping_id" in methods) and not self.library.is_music:
logger.debug("")
logger.debug("Validating Method: mapping_id")
if not meta[methods["mapping_id"]]:
value = match_data[match_methods["mapping_id"]] if "mapping_id" in match_methods else meta[methods["mapping_id"]]
if not value:
raise Failed(f"{self.type_str} Error: mapping_id attribute is blank")
logger.debug(f"Value: {meta[methods['mapping_id']]}")
mapping_id = meta[methods["mapping_id"]]
logger.debug(f"Value: {value}")
mapping_id = value
if not mapping_id and (isinstance(mapping_name, int) or mapping_name.startswith("tt")) and not self.library.is_music:
if mapping_id is None and (isinstance(mapping_name, int) or mapping_name.startswith("tt")) and not self.library.is_music:
mapping_id = mapping_name
item = []
if not mapping_id:
title = mapping_name
else:
if mapping_id is not None:
if str(mapping_id).startswith("tt"):
id_type = "IMDb"
else:
@ -1470,61 +1477,69 @@ class MetadataFile(DataFile):
else:
logger.error(f"{self.type_str} Error: {id_type} ID not mapped")
continue
title = None
if "title" in methods:
if meta[methods["title"]] is None:
logger.error(f"{self.type_str} Error: title attribute is blank")
else:
title = meta[methods["title"]]
blank_edition = False
edition_titles = []
edition_contains = []
if self.library.is_movie:
if "blank_edition" in methods:
if "blank_edition" in match_methods or "blank_edition" in methods:
logger.debug("")
logger.debug("Validating Method: blank_edition")
logger.debug(f"Value: {meta[methods['blank_edition']]}")
blank_edition = util.parse(self.type_str, "blank_edition", meta, datatype="bool", methods=methods, default=False)
if "edition_filter" in methods:
value = match_data[match_methods["blank_edition"]] if "blank_edition" in match_methods else meta[methods["blank_edition"]]
logger.debug(f"Value: {value}")
blank_edition = util.parse(self.type_str, "blank_edition", value, datatype="bool", default=False)
if "edition" in match_methods or "edition_filter" in methods:
logger.debug("")
logger.debug("Validating Method: edition_filter")
logger.debug(f"Value: {meta[methods['edition_filter']]}")
edition_titles = util.parse(self.type_str, "edition_filter", meta, datatype="strlist", methods=methods)
if "edition_contains" in methods:
value = match_data[match_methods["edition"]] if "edition" in match_methods else meta[methods["edition_filter"]]
logger.debug(f"Value: {value}")
edition_titles = util.parse(self.type_str, "edition", value, datatype="strlist")
if "edition_contains" in match_methods or "edition_contains" in methods:
logger.debug("")
logger.debug("Validating Method: edition_contains")
logger.debug(f"Value: {meta[methods['edition_contains']]}")
edition_contains = util.parse(self.type_str, "edition_contains", meta, datatype="strlist", methods=methods)
value = match_data[match_methods["edition_contains"]] if "edition_contains" in match_methods else meta[methods["edition_contains"]]
logger.debug(f"Value: {value}")
edition_contains = util.parse(self.type_str, "edition_contains", value, datatype="strlist")
if not item:
titles = []
if "title" in match_methods:
logger.debug("")
logger.debug("Validating Method: title")
value = match_data[match_methods["title"]]
if not value:
raise Failed(f"{self.type_str} Error: title attribute is blank")
titles.extend(util.parse(self.type_str, "title", value, datatype="strlist"))
if not titles:
titles.append(mapping_name)
if "alt_title" in methods:
logger.debug("")
logger.debug("Validating Method: alt_title")
value = meta[methods["alt_title"]]
if not value:
raise Failed(f"{self.type_str} Error: alt_title attribute is blank")
titles.append(value)
year = None
if "year" in methods and not self.library.is_music:
if meta[methods["year"]] is None:
if "year" in match_methods or "year" in methods:
logger.debug("")
logger.debug("Validating Method: year")
value = match_data[match_methods["year"]] if "year" in match_methods else meta[methods["year"]]
if not year:
raise Failed(f"{self.type_str} Error: year attribute is blank")
try:
year_value = int(str(meta[methods["year"]]))
if 1800 <= year_value <= next_year:
year = year_value
except ValueError:
pass
if year is None:
raise Failed(f"{self.type_str} Error: year attribute must be an integer between 1800 and {next_year}")
item = self.library.search_item(title, year=year)
logger.debug(f"Value: {value}")
year = util.parse(self.type_str, "year", value, datatype="int", minimum=1800, maximum=next_year)
if not item and "alt_title" in methods:
if meta[methods["alt_title"]] is None:
logger.error(f"{self.type_str} Error: alt_title attribute is blank")
else:
alt_title = meta[methods["alt_title"]]
item = self.library.search_item(alt_title, year=year)
if not item:
item = self.library.search_item(alt_title)
for title in titles:
temp_items = self.library.search_item(title, year=year)
item.extend(temp_items)
if not item:
logger.error(f"Skipping {mapping_name}: Item {title} not found")
logger.error(f"Skipping {mapping_name}: Item not found")
continue
if not isinstance(item, list):
item = [item]
if blank_edition or edition_titles or edition_contains:
@ -1569,7 +1584,7 @@ class MetadataFile(DataFile):
logger.info("")
logger.separator(f"Updating {i.title}", space=False, border=False)
logger.info("")
self.update_metadata_item(i, title, mapping_name, meta, methods)
self.update_metadata_item(i, mapping_name, meta, methods)
except Failed as e:
logger.error(e)
except NotScheduled as e:
@ -1577,7 +1592,7 @@ class MetadataFile(DataFile):
except Failed as e:
logger.error(e)
def update_metadata_item(self, item, title, mapping_name, meta, methods):
def update_metadata_item(self, item, mapping_name, meta, methods):
updated = False
@ -1674,8 +1689,7 @@ class MetadataFile(DataFile):
genres = tmdb_item.genres
#item.batchEdits()
if title:
add_edit("title", item, meta, methods, value=title)
add_edit("title", item, meta, methods)
add_edit("sort_title", item, meta, methods, key="titleSort")
if self.library.is_movie:
if "edition" in methods and not self.library.plex_pass:

Loading…
Cancel
Save