Page 1 of 1

How to escape the '{' and '}' characters in a format expression?

Posted: 23 Apr 2023, 11:40
by GazzaRob
I'd like to create a naming format expression with the '{' and '}' characters in the formatted name, something like:

Code: Select all

MySeriesName {1234}/S01E01 - EpisodeName.mkv
How do I escape the curly bracket characters and have them treated as literal characters and not part of a token?

Re: How to escape the '{' and '}' characters in a format expression?

Posted: 23 Apr 2023, 17:47
by rednoah
e.g.

Code: Select all

{ "{1234}" }

Re: How to escape the '{' and '}' characters in a format expression?

Posted: 24 Apr 2023, 10:50
by GazzaRob
Thanks, but maybe I need to clarify more ... the 1234 was supposed to represent an id which is inserted as part of the formatting, e.g. a {tmdbid}, so I want to use '{' and '}' as literal characters. This is what I have tried - based on your reply:

Code: Select all

{n} { "{" }{tmdbid}{ "}" }/{s00e00}.{n.space('.')} - {t}
but it's giving an "Unexpected input: '}'" error.

I want output like this:

Code: Select all

Firefly {1437}/S01E01.Firefly - Serenity
where 1427 is the tmdbid.

Re: How to escape the '{' and '}' characters in a format expression?

Posted: 27 Apr 2023, 17:36
by rednoah
e.g.

Code: Select all

{ "{" + tmdbid + "}" }
or

Code: Select all

{ "{$tmdbid}" }

:arrow: I recommend using the {plex.id} format if you're naming files for Plex and friends.

Re: How to escape the '{' and '}' characters in a format expression?

Posted: 28 Apr 2023, 05:36
by GazzaRob
Thanks for that. The reason I don't want to use {plex.id} is that it seems to hardcode in a folder name "Media" which I don't want ...
rednoah wrote: 27 Apr 2023, 17:36 e.g.

Code: Select all

{ "{" + tmdbid + "}" }
or

Code: Select all

{ "{$tmdbid}" }

:arrow: I recommend using the {plex.id} format if you're naming files for Plex and friends.

Re: How to escape the '{' and '}' characters in a format expression?

Posted: 28 Apr 2023, 06:00
by rednoah
The top-level Media folder is not coded at all.

The category-level Movies / TV Shows folder is part of the {plex.id} format but you can use {plex.id.tail} to get only the path on the right-hand side:
rednoah wrote: 12 Sep 2016, 10:03 You can 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 but 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 }
or
rednoah wrote: 12 Sep 2016, 10:03 e.g. Avatar (2009) {tmdb-19995}/Avatar (2009) {tmdb-19995}

Code: Select all

{ ~plex.id }