Plex edition tags such as {edition-4k Remux}

Support for Windows users
Post Reply
GreenLantern81
Posts: 41
Joined: 29 Mar 2020, 07:40

Plex edition tags such as {edition-4k Remux}

Post by GreenLantern81 »

Hi!

Im using this for Plex on my 2160p movies:

Code: Select all

G:/Min enhet/media/4k/movies-sorted-4k/{az}/{n} ({y})/{n} ({y}) {imdbid} {vf} {hdr} {vcf} {tags} {vs} {hdr} {ac channels} {vc} {tags}{'-'+group}
Is it possible to add Plex edtion tag so if the movie is 2160 and NO remux in filename it adds {edition-4k} or if it contains 2160p AND remux it adds {edition-4k Remux}
The {edition-} tag is used in radarr, im guessing that {tags} is filebots name for this.

Thank you!
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex edition tags

Post by rednoah »

You can modify your custom format to yield arbitrary file paths, so you can add {edition-something} anywhere based on arbitrary information.


e.g. add {edition-Directors Cut}

Code: Select all

{ "{edition-${tags[0]}}" }
:arrow: The movie {tags} and movie {edition} bindings


e.g. add {edition-4K}

Code: Select all

{ h > 2000 ? '{edition-4K}' : '{edition-HD}' }
:arrow: Separate 4K Movies and non-4K Movies


e.g.
GreenLantern81 wrote: 21 Jan 2023, 18:46 if it contains 2160p AND remux it adds {edition-4k Remux}

Code: Select all

{ fn =~ /2160p/ ? fn =~ /(?i)remux/ ? '{edition-4k Remux}' : '{edition-4k}' : null }
:idea: Please read the FAQ and How to Request Help.
GreenLantern81
Posts: 41
Joined: 29 Mar 2020, 07:40

Re: Plex edition tags such as {edition-4k Remux}

Post by GreenLantern81 »

Thank you rednoah for the detailed info! This was exactly what i needed.
I would never have solved this on my own. I really like you app!!
GreenLantern81
Posts: 41
Joined: 29 Mar 2020, 07:40

Re: Plex edition tags

Post by GreenLantern81 »

rednoah wrote: 21 Jan 2023, 19:12 You can modify your custom format to yield arbitrary file paths, so you can add {edition-something} anywhere based on arbitrary information.


e.g. add {edition-Directors Cut}

Code: Select all

{ "{edition-${tags[0]}}" }
:arrow: The movie {tags} and movie {edition} bindings


e.g. add {edition-4K}

Code: Select all

{ h > 2000 ? '{edition-4K}' : '{edition-HD}' }
:arrow: Separate 4K Movies and non-4K Movies


e.g.
GreenLantern81 wrote: 21 Jan 2023, 18:46 if it contains 2160p AND remux it adds {edition-4k Remux}

Code: Select all

{ fn =~ /2160p/ ? fn =~ /(?i)remux/ ? '{edition-4k Remux}' : '{edition-4k}' : null }
Hello again...
Instead of opening a new thread with almost the same question i hope it is ok to write here again....

I have been trying to add "SWESUB" to my folders if the folder or filename contains "NORDIC".
I have been playing around with the help you gave me, starting with the "fn" command but i cant get it right.
I have tried this but with different version:

Code: Select all

X:/storage/down/move/TV/{az}/{ny}/Season {s00} { fn =~ /NORDIC/ ? '(swesub,{vf},{hd},{vs})' : null }/{fn}{ fn.match(/sample|trailer/)}
A example:

Code: Select all

National.Treasure.Edge.of.History.S01.NORDiC.1080p.WEB-DL.H.264-RAPiDCOWS/National.Treasure.Edge.of.History.S01E01.NORDiC.1080p.WEB-DL.H.264-RAPiDCOWS.mkv
I want to be:

Code: Select all

National Treasure - Edge of History (2022)/Season 01 (swesub,{vf},{hd},{vs})/National.Treasure.Edge.of.History.S01E01.NORDiC.1080p.WEB-DL.H.264-RAPiDCOWS.mkv
And if does not contain "NORDIC"

Code: Select all

National Treasure - Edge of History (2022)/Season 01/National.Treasure.Edge.of.History.S01E01.NORDiC.1080p.WEB-DL.H.264-RAPiDCOWS.mkv
What am i missing?
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex edition tags

Post by rednoah »

GreenLantern81 wrote: 11 Feb 2023, 07:27 I have been trying to add "SWESUB" to my folders if the folder or filename contains "NORDIC".
:arrow: This it's just that, then it's easy:

Code: Select all

{ fn =~ /SWESUB/ ? 'NORDIC' : null }
:arrow: But seems like you want NORDIC and some media information if it's SWESUB files, i.e. completely different code for a specific subset of files:

Code: Select all

{
	fn =~ /SWESUB/ ? "(NORDIC, $vf, $hd, $vs)" : null
}
:arrow: However, vs may be undefined so we need to account for that:

Code: Select all

{
	if (fn =~ /SWESUB/) {
		return allOf{'NORDIC'}{vf}{hd}{vs}.joining(', ', '(', ')')
	}
}
:idea: Please read the FAQ and How to Request Help.
GreenLantern81
Posts: 41
Joined: 29 Mar 2020, 07:40

Re: Plex edition tags such as {edition-4k Remux}

Post by GreenLantern81 »

Thank you! Your're a god!
GreenLantern81
Posts: 41
Joined: 29 Mar 2020, 07:40

Re: Plex edition tags such as {edition-4k Remux}

Post by GreenLantern81 »

Well, Im not getting it right.... Ive tried

Code: Select all

X:/storage/down/move/other02/!_TV/{az}/{ny}/Season {s00} { fn =~ /SWESUB/ ? "(NORDIC,$vf,$hd,$vs)" : null }/{fn}{ fn.match(/sample|trailer/)}
It gives me:
https://i.imgur.com/xuk0lkZ.png
Image

Code: Select all

X:/storage/down/move/other02/!_TV/{az}/{ny}/Season {s00} { if (fn =~ /SWESUB/) { return allOf{'NORDIC'}{vf}{hd}{vs}.joining(', ', '(', ')')} }/{fn}{ fn.match(/sample|trailer/)}
Gives me exactly the same as above.....
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex edition tags such as {edition-4k Remux}

Post by rednoah »

fn =~ /SWESUB/ checks if the current file name contains the keyword SWESUB. The screenshot above shows files that do not contain the keyword SWESUB and thus your code adds nothing to the season folder name for those files.


:idea: You can have your if-then-else print a value either way, so that you can run tests and see which way your code goes:

Code: Select all

{ fn =~ /SWESUB/ ? 'YES SWESUB' : 'NO SWESUB' }

:idea: Looks like you might want to check for NORDIC (case-insensitive) so you'll want to modify your code to check for that:

Code: Select all

{ fn =~ /(?i)NORDIC/ ? 'YES NORDIC' : 'NO NORDIC' }

:idea: You can use multiple lines. You do not have to squash your format into a single line.
:idea: Please read the FAQ and How to Request Help.
GreenLantern81
Posts: 41
Joined: 29 Mar 2020, 07:40

Re: Plex edition tags such as {edition-4k Remux}

Post by GreenLantern81 »

I am really sorry, i missed that.
I have been toying so much with filebot the last days. :|

Thank you!
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex edition tags such as {edition-4k Remux}

Post by rednoah »

No worries. I also apparently read the original request wrong way around. :lol:
:idea: Please read the FAQ and How to Request Help.
Post Reply