Page 1 of 1
Add {edition} to the movie folder name when using the {plex} format?
Posted: 05 Oct 2023, 23:27
by FabulousTiger
I am in need of some help finding or fine-tuning my final naming scheme. I currently am using
Shell: Select all
/media/{fn.match(/Open.Matte/) ? '/Open Matte/ ' : "" }/{ vf =~ /2160p/ ? '4K Movies' : 'Movies' } / { ~plex.id % { fn =~ /open.matte/ ? " {edition-Open Matte}" : " {edition-$edition}" } % { ' (' + director + ')' } % { ' ' + hdr } % { ' ' + vf } % { ' ' + vcf } % { ' ' + ac } % { ' ' + channels } }
The Open Matte part is not needed and wont be moving forward. Though I am in need of haveing the top folder include the edition, with tmdb after it. Director is also not moving forward as I have never used it when looking for or at the files.
My need is /{ vf =~ /2160p/ ? '4K Movies' : 'Movies' } As I keep them in separate folders. But I want to keep edition movies in their own folder. As in with "{plex.id} {edition-$edition} " maybe if possible have the tmdb at the end i guess I would have to not use {plex.id}. "{plex} {edition-$edition} {tmdb-$tmdbid}" something like that? (no clue if it's correctly setup as it's just thoughts). Then have file names plex ready with my choice of vf, vcf, HDR and so on. Also I need one exactly the same but it adds the year to series as {plex.id} doesn't include the year the show came out but it does for movies.
Shell: Select all
/{ vf =~ /2160p/ ? '4K Movies' : 'Movies' }/{ ~plex % edition-$edition % tmdb-$tmdbid %}/{ plex %% edition-$edition % { ' ' + hdr } % { ' ' + vf } % { ' ' + vcf } % { ' ' + ac } % { ' ' + channels }
Something like that that works and cleaned up as I don't understand the % tab and spacing stuff completely.
Re: Help with a final nameing scheme
Posted: 06 Oct 2023, 04:31
by rednoah
You can use
* to append values to the movie folder name.
e.g.

Please read
Advanced {plex} operators for details.

All the
TAB and
SPACE sequences can be reduced to a single
SPACE. You may want to consider using
NEWLINE for readability though.
%% is just invalid code.
% edition-$edition % tmdb-$tmdbid % is just invalid code. Please compare your code to the examples and compare & contrast.
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 06 Oct 2023, 09:01
by FabulousTiger
Shell: Select all
/{ vf =~ /2160p/ ? '4K Movies' : 'Movies' }/{ ~plex.id ** { " {edition-$edition}" } %
{ ' ' + hdr } %
{ ' ' + vf } %
{ ' ' + vcf } %
{ ' ' + ac } %
{ ' ' + channels }}
Like so? And could I do this to inject a year into series the same way with the
Shell: Select all
/{ vf =~ /2160p/ ? '4K TV Shows' : 'TV Shows' }/{ ~plex.id * {({y})} %
{ ' ' + hdr } %
{ ' ' + vf } %
{ ' ' + vcf } %
{ ' ' + ac } %
{ ' ' + channels }}
the {({y})} part i assume is wrong as it feels wrong and I can't test before I get home. Though
might work right?
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 06 Oct 2023, 10:36
by rednoah
IDK. Try it. See what you get. Paste screenshots or file paths if what you get is not what you want.

Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 06 Oct 2023, 14:18
by FabulousTiger
Will try when I get home.

Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 06 Oct 2023, 22:15
by FabulousTiger
I ended up with these two formats for movies and TV.
For TV I switched to
for consistency with plex.id for movies.
Is there anything I can run into that might become a problem with this setup?
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 07 Oct 2023, 04:14
by rednoah

e.g. if
{channels} fails, then the trailing
] fails in solidarity. See
Learn how {expressions} work and useful Helper Functions for details.
The correct way of combining a set of bindings that each may or may not be defined works like this:
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 07 Oct 2023, 22:06
by FabulousTiger
These two are what I am now using with your suggestion of the proper way of joining the latter part.
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 28 Jan 2024, 18:47
by iKUd
When using this it looks like this.
Shell: Select all
4K TV Shows/Firefly (2002) {tmdb-1437}/Season 01/Firefly - S01E01 - Serenity [2160p, HDR10+, 15 Mbps, HEVC, AAC, 5.1]
Pretty close to what I'd like to have. Should have worked around with plex.id earlier
Two things I wasnt able to ajust:
Lower the s and e to s01e01 (would be nice but if it not possible I can life with it)
and
Add {group} behind the group within [] .
Because when just adding it destroys the naming when facing subs
Shell: Select all
{ vf =~ /2160p/ ? '4K TV Shows' : 'TV Shows' }/{ ~plex * { ' (' + y + ')' } * {" {tmdb-" + {id} + "}"} % { allOf{vf}{hdr}{bitrate}{vcf}{ac}{channels}.joining(', ', ' [', ']') }}-{group}
Shell: Select all
4K TV Shows/Firefly (2002) {tmdb-1437}/Season 01/Firefly - S01E01 - Serenity [2160p, HDR10+, 15 Mbps, HEVC, AAC, 5.1].eng.forced-FiN
In the end with both fixes it should look like this
Series
Shell: Select all
4K TV Shows/Firefly (2002) {tmdb-1437}/Season 01/Firefly - s01e01 - Serenity [2160p, HDR10+, 15 Mbps, HEVC, AAC, 5.1]-FiN
Series with Sub
Shell: Select all
4K TV Shows/Firefly (2002) {tmdb-1437}/Season 01/Firefly - s01e01 - Serenity [2160p, HDR10+, 15 Mbps, HEVC, AAC, 5.1]-FiN.eng.forced
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 29 Jan 2024, 08:44
by rednoah
e.g. add series year to both folder name and file name:
e.g. add group at the end of the file name but before the subtitle language suffix:
e.g. match S01E01 patterns and make them lower-case:
** you may prefer to just make your own custom format and just not use {plex} at some point; because coercing {plex} into doing what you want will get more complicated than just doing what you want at some point
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 30 Jan 2024, 16:46
by iKUd
The problem here is:
I have a year in the seriesname which I dont want to have there.
I cant change the ID so if I want tvdb or imdb in the future I have to rewrite everything.
Where or how do I have to add
Shell: Select all
{ -group }).path.replaceAll(/S\d+|E\d+/){ it.lower() } }
in my string?
Shell: Select all
{ vf =~ /2160p/ ? '4K TV Shows' : 'TV Shows' }/{ ~plex * { ' (' + y + ')' } * {" {tmdb-" + {id} + "}"} % { allOf{vf}{hdr}{bitrate}{vcf}{ac}{channels}.joining(', ', ' [', ']') }}
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 30 Jan 2024, 17:17
by rednoah
iKUd wrote: ↑30 Jan 2024, 16:46
I have a year in the seriesname which I dont want to have there.
{plex.year} handles the
"series name that has (year) in the series name already" issue by default.

TheTVDB ensures that each series has a unique name, so the year is added to the name as part of the name to make the name unique, e.g.
Doctor Who vs
Doctor Who (2005). If you do
{n} ({y}) then you get
Doctor Who (2005) (2005).

TheMovieDB allows two or more series entries to share the same name, i.e.
Doctor Who and
Doctor Who. If you use TheMovieDB then you don't have to worry about the
"series name already contains the year as part of the series name" problem at all.
iKUd wrote: ↑30 Jan 2024, 16:46
I cant change the ID so if I want tvdb or imdb in the future I have to rewrite everything.
You'll wan to use the TheMovieDB ID and stick to the TheMovieDB ID. If you have the TheMovieDB ID then you can add other IDs later.
As for your format, you can just copy & paste the bits and pieces together. I'm using multiple lines for readability:
Code: Select all
TV Shows/Cowboy Bebop (1998) {tmdb-30991}/Season 01/Cowboy Bebop (1998) - s01e01 - Stray Dog Strut [720p, 4.3 Mbps, AVC, AAC, 5.1]-CBM
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 31 Jan 2024, 15:26
by iKUd
So when using the .year in plex.year I have to life with the second year?
I'm ok with the first year in the folder but with the year in the series name.
Shell: Select all
TV Shows/Cowboy Bebop (1998) {tmdb-30991}/Season 01/Cowboy Bebop - s01e01 - Stray Dog Strut [720p, 4.3 Mbps, AVC, AAC, 5.1]-CBM
But I can take away the year and add it with y than I did before.
Re: Add {edition} to the movie folder name when using the {plex} format?
Posted: 31 Jan 2024, 17:55
by rednoah
iKUd wrote: ↑31 Jan 2024, 15:26
So when using the .year in plex.year I have to life with the second year?
If you use
{plex.year} then you will
never get a double year, as in
Doctor Who (2005) (2005) double year.

If you want the year in the in folder name but
not in the file name, then you
cannot use
{plex.year} and you will instead want to inject the
(year) bit via the
* operator.
If you use TheMovieDB then your code will always work as expected.
If you use TheTVDB then you will need additional code that optionally injects the
(year) depending on whether or not the series name
{n} and thus
{plex} already includes the
(year) bit. You may also need to remove the
(year) bit from the file name if it's there by merit of being part of the series name. So just don't use TheTVDB. It'll make your use case unnecessarily complicated.