Plex Naming Schemes

All about user-defined episode / movie format expressions
Post Reply
User avatar
rednoah
The Source
Posts: 16817
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Plex Naming Schemes

Post by rednoah » 12 Sep 2016, 10:03

Plex Naming Standard

Plex has strict standards for naming and organizing your media files.

Code: Select all

Movies/Avatar (2009)/Avatar (2009)
TV Shows/Alias/Season 01/Alias - S01E01 - Truth Be Told
The {plex} binding which will give you the appropriate Plex path for movies, TV episodes, Anime episodes and music files:

Code: Select all

{plex}
Since the {plex} binding will give you a File object, it's easy to reuse some path components and omit others. {plex.name} and {plex.tail} are particularly useful if you want to rename files in place or if you want the {plex} path without the top-level Movies or TV Shows folder.


e.g. Avatar (2009)

Code: Select all

{plex.name}
e.g. Firefly/Season 01/Firefly - S01E01 - Serenity

Code: Select all

{plex.tail}
e.g. Firefly/Firefly - S01E01 - Serenity

Code: Select all

{plex[1]}/{plex[3]}
e.g. Movies/Avatar (2009)/Avatar (2009) by James Cameron [720p, x264, AC3]

Code: Select all

{plex.derive{" by $director"}{" [$vf, $vc, $ac]"}}

Image



Kodi Naming Standard

The {kodi} binding (requires FileBot 4.8.5) and the {plex} binding work exactly the same, with slightly different implementation details, e.g. SxE formatting and multi-episode formatting.



Custom Naming Schemes

If you need to make very specific customizations to the standard Plex naming scheme, you'll want you write your own format expression so you have full control over all the bits and pieces. You can get started by copying the following examples and modifying them to your liking.

Movies

Code: Select all

Movies/{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}
TV Series

Code: Select all

TV Shows/{n}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
Anime

Code: Select all

Anime/{primaryTitle}/{primaryTitle} - {sxe} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, /'/).replacePart(', Part $1')}
Music

Code: Select all

Music/{n}/{album+'/'}{pi.pad(2)+'. '}{artist} - {t}
:idea: Please read the FAQ and How to Request Help.

Gruff10
Posts: 2
Joined: 21 Jan 2019, 21:41

Re: Plex Naming Schemes

Post by Gruff10 » 21 Jan 2019, 21:57

Hi,

NOOB here :?

Using

Code: Select all

{plex.derive{" [$vf.$vc.$ac]"}}
I find that the TV series 24 (Twenty Four) fails because the fullstops in its episode titles are being replaced (see output below).

https://ibb.co/87vTcrF

How can I get around this?

Thanks.

User avatar
rednoah
The Source
Posts: 16817
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex Naming Schemes

Post by rednoah » 22 Jan 2019, 05:12

Yes, the {plex} format does indeed strip trailing "." characters from the Plex path. In your case, that's unnecessary, but the {plex} binding can't know that.

e.g.

Code: Select all

$ filebot -list --q 24 --format {plex} --filter "s == 1 && e <= 3"
TV Shows/24/Season 01/24 - S01E01 - 12.00 A.M. - 1.00 A.M
TV Shows/24/Season 01/24 - S01E02 - 1.00 A.M. - 2.00 A.M
TV Shows/24/Season 01/24 - S01E03 - 2.00 A.M. - 3.00 A.M

If want to preserve the trailing "." then you can use a full custom format such as this:

Code: Select all

TV Shows/{n}/Season {s.pad 2}/{n} - {s00e00} - {t} [{vf}.{vc}.{ac}]
:idea: Please read the FAQ and How to Request Help.

Gruff10
Posts: 2
Joined: 21 Jan 2019, 21:41

Re: Plex Naming Schemes

Post by Gruff10 » 22 Jan 2019, 12:06

Thanks. That worked, though the ":"s in the episode titles are a pain as well. At least the Validate button clears them ;)

User avatar
rednoah
The Source
Posts: 16817
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex Naming Schemes

Post by rednoah » 22 Jan 2019, 14:06

Additional customizations like this will do the job:

Code: Select all

{n.colon(' - ')}

The {plex} format does take care of these corner cases already, and if you need all of those but if you want more control, then you can start with a format such as this, and then modify it to your needs:

Code: Select all

TV Shows/{n}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
:idea: The .replaceAll(/[!?.]+$/) bit is responsible for removing trailing !?. so you could just cut that bit.
:idea: Please read the FAQ and How to Request Help.

Kopernikus
Posts: 5
Joined: 03 Feb 2019, 20:07

Re: Plex Naming Schemes

Post by Kopernikus » 07 Feb 2019, 14:11

Hi,

If I use:

Code: Select all

{plex.derive {" [$vf.$vc.$ac]"}}
I get

Code: Select all

/volume1/video/Movies/xXx (2002)/xXx (2002) [480p.x264.AC3].mkv
but how to I get

Code: Select all

/volume1/video/Movies/xXx (2002) [480p.x264.AC3]/xXx (2002) [480p.x264.AC3].mkv
or

Code: Select all

/volume1/video/Movies/xXx (2002) [480p.x264.AC3]/xXx (2002).mkv
I want to use the Plex format, but to now the video format so I now for example when I replace a SD by HD version of the same movie.

Thx

User avatar
rednoah
The Source
Posts: 16817
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex Naming Schemes

Post by rednoah » 07 Feb 2019, 14:38

There's no convenience method for this particular use case.

You'll either have to
(A) write your own custom format without using the {plex} binding at all, or
(B) write your own custom format using bits and pieces of the {plex} binding as necessary.

e.g.

Code: Select all

Movies/{plex[1]}{" [$vf.$vc.$ac]"}/{plex[2]}{" [$vf.$vc.$ac]"}

:!: Either way, you'll no longer be strictly adhering to the Plex naming scheme, although it'll probably work.
:idea: Please read the FAQ and How to Request Help.

Post Reply