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

Any questions? Need some help?
Post Reply
GazzaRob
Posts: 3
Joined: 23 Apr 2023, 11:21

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

Post 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?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post by rednoah »

e.g.

Code: Select all

{ "{1234}" }
:idea: Please read the FAQ and How to Request Help.
GazzaRob
Posts: 3
Joined: 23 Apr 2023, 11:21

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

Post 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.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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.
:idea: Please read the FAQ and How to Request Help.
GazzaRob
Posts: 3
Joined: 23 Apr 2023, 11:21

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

Post 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.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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 }
:idea: Please read the FAQ and How to Request Help.
Post Reply