Plex Jellyfin Editions with Multi Tags / Matching

All about user-defined episode / movie / file name format expressions
Post Reply
ByteShare
Posts: 27
Joined: 13 Mar 2018, 15:38

Plex Jellyfin Editions with Multi Tags / Matching

Post by ByteShare »

Hi, I've tried a bit and searched around but haven't figured out a way to correctly match parts of a string of tags at a time.
Please help :D

3 initial matches

Code: Select all

{fn.matchAll(/Unrated|\[UR\]/)?'UR':''}
{fn.matchAll(/DirectorsCut|Director.*Cut|Director'sCut|\[DC]/)?' DC':''}
{fn.matchAll(/ExtendedEdition|\[EE\]|\[Extended\]|Extended|\[Ext\]/)?' Ext':''}
Starting point for the Editions Tag (I use both Jellyfin and Plex so I combine the formats)

Code: Select all

{" - [{edition-${}]"}
This works but only if I match all 3 at the same time, so I know I'm doing something wrong but I don't know what would fix it.
I'm assuming it has something to do with the "$" :?:

Code: Select all

{" - [{edition-${fn.matchAll(/Unrated|\[UR\]/)?'UR':''}${fn.matchAll(/DirectorsCut|Director.*Cut|Director'sCut|\[DC]/)?' DC':''}${fn.matchAll(/ExtendedEdition|\[EE\]|\[Extended\]|Extended|\[Ext\]/)?' Ext':''}}]"}
Update: Just saw your link to viewtopic.php?t=12643 Not sure if this will solve my problem but I'll take a look at that.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex Jellyfin Editions with Multi Tags / Matching

Post by rednoah »

Does {tags} not work for you? Are you set on your UR / DC / Ext abbreviation and normalisation step?
viewtopic.php?t=12668


:idea: You'll want to keep in mind the that the outer-most {...} delimit Groovy code, and are thus completely different in meaning from inner {...} which are Groovy code:
viewtopic.php?t=1895


:?: Do Plex / Jellyfin / etc support multiple {edition-XYZ} tags?

Code: Select all

{edition-X} {edition-Y} {edition-Z}
:?: Do you want to generate a custom edition value that just combines multiple tags as single edition value?

Code: Select all

{edition-X and Y and Z}


:arrow: You probably mean to write something like this:

Code: Select all

{
	def value = tags.join(' ').replace('Uncut':'UC', 'Unrated':'UR')
	'{edition-' + value + '}'
}
:idea: Please read the FAQ and How to Request Help.
ByteShare
Posts: 27
Joined: 13 Mar 2018, 15:38

Re: Plex Jellyfin Editions with Multi Tags / Matching

Post by ByteShare »

--"Do Plex / Jellyfin / etc support multiple {edition-XYZ} tags?"
Both do support 1 edition in a file name, but what ever you want as long as it is between the [] and/or {}, like I have it will show that whole string as an "Edition"
So only " - [{edition-STUFF}]" one time in a filename
So not this:

Code: Select all

{edition-X} {edition-Y} {edition-Z}
--I'd have to think if I want to change my custom tags, because I usually got for shorter filenames (especially now with the long format for Editions). Also, I do need some custom tagging (not all shown here) for example Rifftrax and FanEdits.

--Basically, I want to combine my custom tags depending what is in the file name:
So "Movie (Year) [UR] Directors Cut Extended.mp4"
Would go to "Movie (Year) - [{edition-UR DC Ext}].mp4"
Or if just one of those (ie UR) it would also match and make the correct editions naming standard.
So

Code: Select all

{edition-X Y Z}

--

Code: Select all

{
	def value = tags.join(' ').replace('Uncut':'UC', 'Unrated':'UR')
	'{edition-' + value + '}'
}
Is that all being run in FileBot from the presets? I'm using presets
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex Jellyfin Editions with Multi Tags / Matching

Post by rednoah »

e.g. you can of course come up with the list of tags with your own custom code:

Code: Select all

{
	def tags = fn.matchAll(/Uncut|Unrated/)
	def edition = tags.join(' ').replace('Uncut':'UC', 'Unrated':'UR')
	'{edition-' + edition + '}'
}
:idea: Note that matchAll() fails if there is no match, as opposed to successfully returning an empty list.



:idea: We're talking about custom formats here. You can use them in Presets which combine many different settings, a custom format being just one of the things that comprise a Preset.



:arrow: You absolutely want to prototype your custom formats in the Format Editor if you are not doing so already:

Screenshot
:idea: Please read the FAQ and How to Request Help.
ByteShare
Posts: 27
Joined: 13 Mar 2018, 15:38

Re: Plex Jellyfin Editions with Multi Tags / Matching

Post by ByteShare »

Long delay, but thank you very much.
I was able to use the groovy code like the example you gave me to make my editions custom definitions!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex Jellyfin Editions with Multi Tags / Matching

Post by rednoah »

Please post your final expressions for the benefit of others and your future self. ;)
:idea: Please read the FAQ and How to Request Help.
ByteShare
Posts: 27
Joined: 13 Mar 2018, 15:38

Re: Plex Jellyfin Editions with Multi Tags / Matching

Post by ByteShare »

This is what I ended up with...two notes:
1. I'm sure this isn't the best way but what you get when you legacy things and don't start from scratch
2. Some of this would only be for me as I'm catching how I used to make "Tags" (ie [Comm]) and converting it to the editions format:

Code: Select all

.\{n.removeAll(/[?:.]+$|:|~/).replaceAll(' - ',' ').replaceAll(/[`´’???]/,"'").upperInitial()}\{n.removeAll(/[?:.]+$|:|~/).replaceAll(' - ',' ').replaceAll(/[`´’???]/,"'").upperInitial()} {episode.special?'00':s.pad(2)}x{es*.pad(2).join('x')} {t.removeAll(/[?:.]+$|:|~/).replaceAll(' - ',' ').replaceAll(/[`´’???]/,"'").upperInitial().replacePart(', Part $1')}
{def tags = fn.matchAll(/Uncut|Unrated|\[UR\]| - \[\{edition-UR\}\]|DirectorsCut|Director Cut|Director's Cut|Director'sCut|\[DC\]|Theatrical|\[Thr\]| - \[\{edition-Thr\}\]|SpecialEdition|\[SE\]| - \[\{edition-SE\}\]|ExtendedEdition|\[EE\]|\[Extended\]Extended|\[Ext\]| - \[\{edition-Ext\}\]|Uncut|\[UC\]| - \[\{edition-UC\}\]|Remastered|\[RM\]| - \[\{edition-RM\}\]|Commentary|\[Comm\]| - \[\{edition-Comm\}\]|\[Rifftrax\]|\[Riff\]| - \[\{edition-Rifftrax\}\]| - \[\{edition-ReCut\}\]|HDR| - \[\{edition-HDR\}\]| DV|FanEdit| - \[\{edition-FanEdit\}\]| - \[\{edition-DV\}\]| - \[\{edition-ENG\}\]| - \[\{edition-JPN\}\]| - \[\{edition-With Logo\}\]/)
	def edition = ' - [{edition-' + tags.join(' ').replace('Uncut':'UC', '[UR]':'UR', 'Unrated':'UR', ' - [{edition-UR}]':'UR', 'DirectorsCut':'DC', 'Director Cut':'DC', 'Director\'sCut':'DC', 'Director\'s Cut':'DC', '[DC]':'DC', 'Theatrical':'Thr', '[Thr]':'Thr', ' - [{edition-Thr}]':'Thr', 'SpecialEdition':'SE', '[SE]':'SE', ' - [{edition-SE}]':'SE', 'ExtendedEdition':'Ext', '[EE]':'Ext', '[Extended]Extended':'Ext', '[Ext]':'Ext', ' - [{edition-Ext}]':'Ext', '[UC]':'UC', ' - [{edition-UC}]':'UC', 'Remastered':'RM', '[RM]':'RM', ' - [{edition-RM}]':'RM', ' - [{edition-ReCut}]':'ReCut', 'HDR':'HDR', ' - [{edition-HDR}]':'HDR', ' DV':'DV', 'FanEdit':'FanEdit', ' - [{edition-FanEdit}]':'FanEdit', ' - [{edition-DV}]':'DV', 'Commentary':'Comm', '[Comm]':'Comm', ' - [{edition-Comm}]':'Comm', '[Rifftrax]':'Rifftrax', '[Riff]':'Rifftrax', ' - [{edition-Rifftrax}]':'Rifftrax', ' - [{edition-ENG}]':'ENG', ' - [{edition-JPN}]':'JPN', ' - [{edition-With Logo}]':'With Logo') + '}]'
	edition
}
Post Reply