Plex tv series naming and {} braces -- how do I do it?

All about user-defined episode / movie / file name format expressions
Post Reply
Jorm
Posts: 20
Joined: 21 Apr 2021, 08:44

Plex tv series naming and {} braces -- how do I do it?

Post by Jorm »

Hi,

Plex states "If you are using the “Plex TV Series” agent, you can optionally include the TMDB or TVDB show ID in the folder name to improve matching. If you choose to do that, it mustbe inside curly braces: ShowName (2020) {tvdb-123456} or ShowName (2020) {tmdb-123456} where 123456 is the show ID. An example can be found at the end of the article."

I've tried to escape the {} with the normal unix \ and with ' but to no avail filebot doesn't like it and I can't get it to name it {} and no don't think [] works even if prettier as plex expects {}.. tips to make it working highly appriciated..

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

Re: Plex tv series naming and {} braces -- how do I do it?

Post by rednoah »

You can copy and paste this from the {plex} format examples:

Code: Select all

{plex.derive{" {tmdb-$id}"}}

You don't need to escape anything as far as I can tell:

Code: Select all

$ filebot -script fn:sysenv '{plex.derive{" {tmdb-$id}"}}'
...
# Arguments #
args[0] = -script
args[1] = fn:sysenv
args[2] = {plex.derive{" {tmdb-$id}"}}
:idea: Please read Cmdline and Argument Passing for details.


:idea: Note that {id} refers to the Series ID or Movie ID of your selected database, not necessarily TheMovieDB.



EDIT:

If Plex doesn't accept {tvdb-78874} patterns as part of the episode file name, then you can inject it into the series folder name like so:

Code: Select all

{plex[0..1]} {"{tvdb-$id}"}/{plex[2..3]}
:idea: Please read the FAQ and How to Request Help.
Jorm
Posts: 20
Joined: 21 Apr 2021, 08:44

Re: Plex tv series naming and {} braces -- how do I do it?

Post by Jorm »

Your right funny I could not get it to work yesterday, been ill the last week so guess I was just tired, thanks for the excellent support even to people how don't think lol.
jkoopmann
Posts: 4
Joined: 29 Oct 2019, 07:58

Re: Plex tv series naming and {} braces -- how do I do it?

Post by jkoopmann »

Code: Select all

{plex.derive{" {tmdb-$id}"}}
I (believe) understand this. However, how do I use this in a --format expression in the cli? E.g. currently I use

Code: Select all

-- format "{ny.colon('-').ascii()}/{ny.colon('-').ascii()} ({imdbid}) ({resolution} {vc} {ac})" 
but (for Plex) I would love to have the brackets around the imdbid to be curly....
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex tv series naming and {} braces -- how do I do it?

Post by rednoah »

"..." has is interpreted by the shell, so you'll need to \" escape " or avoid " altogether.


:idea: Please read Cmdline and Argument Passing for details.


:idea: Use the @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.
jkoopmann
Posts: 4
Joined: 29 Oct 2019, 07:58

Re: Plex tv series naming and {} braces -- how do I do it?

Post by jkoopmann »

Hi,

thanks.... but I seem to be too stupid. Sorry.


I tried putting things in a text file and use @file however this seems to conflict with the filebot.sh wrapper on FreeBSD.

Code: Select all

/usr/local/filebot/filebot.sh --format "{ny.colon('-').ascii()} ({imdbid}) ({resolution} {vc} {ac})" -non-strict --lang de --db TheMovieDB -rename *.mkv
works but puts the imdb in () brackets. What should the command line look like to put it in curly {} brackets? I would be very grateful to get a specific hint.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex tv series naming and {} braces -- how do I do it?

Post by rednoah »

e.g.

Code: Select all

--format '{ny.colon("-").ascii()} {"{$imdbid}"} ({resolution} {vc} {ac})'
:idea: We use '...' to quote the argument, so that we can use "..." in the argument value.
:idea: Please read the FAQ and How to Request Help.
yodaspowart
Posts: 16
Joined: 02 Jun 2017, 01:04

Re: Plex tv series naming and {} braces -- how do I do it?

Post by yodaspowart »

Thanks rednoah, been wanting to know how to do this for a while:

Code: Select all

{"{imdb-$imdbid}"}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex tv series naming and {} braces -- how do I do it?

Post by rednoah »

(requires FileBot 4.9.4 ​or higher) The {plex} format now has built-in support for {id-123} tags:

Code: Select all

{ plex.id }
:idea: Please read the FAQ and How to Request Help.
nyxtyr
Posts: 14
Joined: 17 Nov 2020, 17:19

Re: Plex tv series naming and {} braces -- how do I do it?

Post by nyxtyr »

Hello, I am also having a similar issue with the {} brackets not being able to output them to the filename.
I tried several things but unable to get it to output how I want it.

Code: Select all

'{'imdb-{'tt'+omdb.imdbId.pad(7)}'}'
"{"imdb-{'tt'+omdb.imdbId.pad(7)}"}"
'{imdb-{'tt'+omdb.imdbId.pad(7)}}'
"{imdb-{'tt'+omdb.imdbId.pad(7)}}"
\{imdb-{'tt'+omdb.imdbId.pad(7)}\}

Code: Select all

/TV Shows/{n} ({y}) imdb-{'tt'+omdb.imdbId.pad(7)}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n} ({y}) - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
Works almost perfectly but I want to add the {} to the imdb-tt1234567 part so it looks like {imdb-tt1234567}

Any help would be greatly appreciated. Thank you.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex tv series naming and {} braces -- how do I do it?

Post by rednoah »

e.g.

Code: Select all

{"{imdb-tt${omdb.imdbId.pad(7)}}"}
:idea: Please read the FAQ and How to Request Help.
nyxtyr
Posts: 14
Joined: 17 Nov 2020, 17:19

Re: Plex tv series naming and {} braces -- how do I do it?

Post by nyxtyr »

rednoah wrote: 31 Oct 2021, 10:46 e.g.

Code: Select all

{"{imdb-tt${omdb.imdbId.pad(7)}}"}
Thank you this worked perfect for me. Updated code snippet below.

Code: Select all

/TV Shows/{ny} {"{imdb-tt${omdb.imdbId.pad(7)}}"}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{ny} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
Post Reply