Add {edition} to the movie folder name when using the {plex} format?

All about user-defined episode / movie / file name format expressions
Post Reply
FabulousTiger
Posts: 13
Joined: 02 Jul 2023, 20:51

Add {edition} to the movie folder name when using the {plex} format?

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

Re: Help with a final nameing scheme

Post by rednoah »

You can use * to append values to the movie folder name.

e.g.

Format: Select all

{ ~plex.id * { " {edition-$edition}" } }
:arrow: 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.
:idea: Please read the FAQ and How to Request Help.
FabulousTiger
Posts: 13
Joined: 02 Jul 2023, 20:51

Re: Add {edition} to the movie folder name when using the {plex} format?

Post 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

Shell: Select all

 { ' (' + y + ')' } 
might work right?
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Add {edition} to the movie folder name when using the {plex} format?

Post by rednoah »

IDK. Try it. See what you get. Paste screenshots or file paths if what you get is not what you want. ;)
:idea: Please read the FAQ and How to Request Help.
FabulousTiger
Posts: 13
Joined: 02 Jul 2023, 20:51

Re: Add {edition} to the movie folder name when using the {plex} format?

Post by FabulousTiger »

Will try when I get home. 👍
FabulousTiger
Posts: 13
Joined: 02 Jul 2023, 20:51

Re: Add {edition} to the movie folder name when using the {plex} format?

Post by FabulousTiger »

I ended up with these two formats for movies and TV.

Format: Select all

{ vf =~ /2160p/ ? '4K Movies' : 'Movies' }/{ ~plex.id ** { " {edition-$edition}" }  %
 {" ["} %  {vf + ', ' } %
  {hdr ? hdr + ', ': '' } %
  {Bitrate + ', ' } %
  {vcf + ', ' } %
  {ac + ', ' } %
  {channels + ']' }}
For TV I switched to

Format: Select all

{ ~plex *  { ' (' + y + ')' } *  {" {tmdb-" + {id} + "}"}}
for consistency with plex.id for movies.

Format: Select all

{ vf =~ /2160p/ ? '4K TV Shows' : 'TV Shows' }/{ ~plex *  { ' (' + y + ')' } *  {" {tmdb-" + {id} + "}"} %
 { " {edition-$edition}" }  %
 {" ["} %
  {vf + ', ' } %
  {hdr ? hdr + ', ': '' }  %
  {Bitrate + ', ' } %
  {vcf + ', ' } %
  {ac + ', ' } %
  {channels + ']' }}
Is there anything I can run into that might become a problem with this setup?
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Add {edition} to the movie folder name when using the {plex} format?

Post 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:

Format: Select all

{
	plex % {
		allOf{vf}{hdr}{bitrate}{vcf}{ac}{channels}.joining(', ', ' [', ']')
	}
}
:idea: Please read the FAQ and How to Request Help.
FabulousTiger
Posts: 13
Joined: 02 Jul 2023, 20:51

Re: Add {edition} to the movie folder name when using the {plex} format?

Post by FabulousTiger »

Format: Select all

{ vf =~ /2160p/ ? '4K Movies' : 'Movies' }/{ ~plex.id ** { " {edition-$edition}" }  %  { allOf{vf}{hdr}{bitrate}{vcf}{ac}{channels}.joining(', ', ' [', ']') }}

Format: Select all

{ vf =~ /2160p/ ? '4K TV Shows' : 'TV Shows' }/{ ~plex *  { ' (' + y + ')' } *  {" {tmdb-" + {id} + "}"} % { allOf{vf}{hdr}{bitrate}{vcf}{ac}{channels}.joining(', ', ' [', ']') 	}}
These two are what I am now using with your suggestion of the proper way of joining the latter part.
iKUd
Posts: 14
Joined: 25 Jan 2024, 18:32

Re: Add {edition} to the movie folder name when using the {plex} format?

Post 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 :roll:

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

Re: Add {edition} to the movie folder name when using the {plex} format?

Post by rednoah »

e.g. add series year to both folder name and file name:

Format: Select all

{ plex.year.id }

e.g. add group at the end of the file name but before the subtitle language suffix:

Format: Select all

{ plex.year.id % { -group } }

e.g. match S01E01 patterns and make them lower-case:

Format: Select all

{ (plex.year.id % { -group }).path.replaceAll(/S\d+|E\d+/){ it.lower() } }
** 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
:idea: Please read the FAQ and How to Request Help.
iKUd
Posts: 14
Joined: 25 Jan 2024, 18:32

Re: Add {edition} to the movie folder name when using the {plex} format?

Post 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(', ', ' [', ']') }}
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Add {edition} to the movie folder name when using the {plex} format?

Post 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.

:idea: 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).

:idea: 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:

Format: Select all

{
	vf =~ /2160p/ ? '4K TV Shows' : 'TV Shows'
}
/
{
	(
		~plex.year.id 
		% { allOf{vf}{hdr}{bitrate}{vcf}{ac}{channels}.joining(', ', ' [', ']') }
		% { -group }
	).path.replaceAll(/S\d+|E\d+/){ it.lower() }
}

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
:idea: Please read the FAQ and How to Request Help.
iKUd
Posts: 14
Joined: 25 Jan 2024, 18:32

Re: Add {edition} to the movie folder name when using the {plex} format?

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

Re: Add {edition} to the movie folder name when using the {plex} format?

Post 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.



:idea: 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.

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