Adding a metadata backup was one of the main reasons for creating this script. I wanted to be able to run a script and have my entire library be recreated if I lost my plex database, so I created this.
In order to edit the metadata of Movies or Shows in a library, you have to add it to the metadata mapping of that library.
Each movie/show is defined by the mapping name which must be the same as the movie/show name in the library unless an alt_title
is specified.
An example of multiple metadata edits in a show library is below:
metadata:
"Avatar: The Last Airbender":
sort_title: Avatar 01
seasons:
1:
title: "Book One: Water"
2:
title: "Book Two: Earth"
3:
title: "Book Three: Fire"
episodes:
S01E01:
rating: 9.1
S03E21:
summary: The Epic Series Final of Avatar The Last Airbender
"Avatar: The Legend of Korra":
sort_title: Avatar 02
alt_title: The Legend of Korra
original_title: The Legend of Korra
seasons:
1:
title: "Book One: Air"
2:
title: "Book Two: Spirits"
3:
title: "Book Three: Change"
4:
title: "Book Four: Balance"
The available attributes for each movie/show are as follows
Name | Attribute | Allowed Values | Works with Movies | Works with Shows |
---|---|---|---|---|
Title | title |
Title if different from the mapping value useful when you have multiple movies with the same name | ✔️ | ✔️ |
Alternative Title | alt_title |
Alternative title to look for | ✔️ | ✔️ |
Year | year |
Year of movie/show for better identification | ✔️ | ✔️ |
TMDb Show ID | tmdb_show |
TMDb Show ID to use for metadata useful for miniseries that have been compiled into a movie | ✔️ | ✔️ |
TMDb Movie ID | tmdb_movie |
TMDb Movie ID to use for metadata useful for movies that have been split into segments | ✔️ | ✔️ |
Seasons | seasons |
seasons mapping details |
❌ | ✔️ |
Episodes | episodes |
episodes mapping details |
❌ | ✔️ |
-
YAML files cannot have two items with the same mapping name so if you have two movies/shows with the same name you would change the mapping values to whatever you want. Then use the
title
attribute to specify the real title and use theyear
attribute to specify which of the multiple movies/shows to choose.metadata: Godzilla1: title: Godzilla year: 1954 content_rating: R Godzilla2: title: Godzilla year: 1998 content_rating: PG-13
-
If you know of another Title your movie/show 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 TMDb uses the nameThe Legend of Korra
, but I want it asAvatar: The Legend of Korra
(Which must be surrounded by quotes since it uses the character:
):metadata: "Avatar: The Legend of Korra": alt_title: The Legend of Korra
This would change the name of the TMDb default
The Legend of Korra
toAvatar: The Legend of Korra
and would not mess up any subsequent runs.
Name | Attribute | Allowed Values | Works with Movies | Works with Shows |
---|---|---|---|---|
Sort Title | sort_title |
Text to change Sort Title | ✔️ | ✔️ |
Original Title | original_title |
Text to change Original Title | ✔️ | ✔️ |
Originally Available | originally_available |
Date to change Originally Available Format: YYYY-MM-DD |
✔️ | ✔️ |
Content Rating | content_rating |
Text to change Content Rating | ✔️ | ✔️ |
Rating | rating |
Number to change Rating | ✔️ | ✔️ |
Studio | studio |
Text to change Studio | ✔️ | ✔️ |
Tagline | tagline |
Text to change Tagline | ✔️ | ✔️ |
Summary | summary |
Text to change Summary | ✔️ | ✔️ |
You can add .remove
to any tag attribute to only remove those tags i.e. genre.remove
.
You can add .sync
to any tag attribute to sync all tags vs just appending the new ones i.e. genre.sync
.
Name | Attribute | Allowed Values | Works with Movies | Works with Shows |
---|---|---|---|---|
Director | director |
List or comma-separated text of each Director Tag | ✔️ | ❌ |
Country | country |
List or comma-separated text of each Country Tag | ✔️ | ❌ |
Genre | genre |
List or comma-separated text of each Genre Tag | ✔️ | ✔️ |
Writer | writer |
List or comma-separated text of each Writer Tag | ✔️ | ❌ |
Producer | producer |
List or comma-separated text of each Producer Tag | ✔️ | ❌ |
Collection | collection |
List or comma-separated text of each Collection Tag | ✔️ | ✔️ |
Label | label |
List or comma-separated text of each Label Tag | ✔️ | ✔️ |
Name | Attribute | Allowed Values | Works with Movies | Works with Shows |
---|---|---|---|---|
Episode Sorting | episode_sorting |
default : Library defaultoldest : Oldest firstnewest : Newest first |
❌ | ✔️ |
Keep Episodes | keep_episodes |
all : All episodes5_latest : 5 latest episodes3_latest : 3 latest episodeslatest : Latest episodespast_3 : Episodes added in the past 3 dayspast_7 : Episodes added in the past 7 dayspast_30 : Episodes added in the past 30 days |
❌ | ✔️ |
Delete Episodes | delete_episodes |
never : Neverday : After a dayweek : After a weekrefresh : On next refresh |
❌ | ✔️ |
Season Display | season_display |
default : Library defaultshow : Showhide : Hide |
❌ | ✔️ |
Episode Ordering | episode_ordering |
default : Library defaulttmdb_aired *: The Movie Database (Aired)tvdb_aired : TheTVDB (Aired)tvdb_dvd : TheTVDB (DVD)tvdb_absolute : TheTVDB (Absolute) |
❌ | ✔️ |
Metadata Language* | 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* | use_original_title |
default : Library defaultno : Noyes : Yes |
✔️ | ✔️ |
* Must be using the New Plex Movie Agent or the New Plex TV Agent
Name | Attribute | Description | Allowed Values |
---|---|---|---|
URL Poster | url_poster |
Used to change the movie/show's poster to the URL | URL of image publicly available on the internet |
File Poster | file_poster |
Used to change the movie/show's poster to the image in the file system | Path to image in the file system |
URL Background | url_background |
Use to change the movie/show's background to the URL | URL of image publicly available on the internet |
File Background | file_background |
Used to change the movie/show's background to the image in the file system | Path to image in the file system |