How can I add {edition-"words from file name"} to file?

All about user-defined episode / movie / file name format expressions
Post Reply
TheFireNinja
Posts: 3
Joined: 08 Apr 2024, 01:04

How can I add {edition-"words from file name"} to file?

Post by TheFireNinja »

I'm seperating the Prelims and Early Prelims of my UFC fights as editions. How do I have it recognize either Prelims or Early.Prelims from the file name and make that the edition name (while also changing the . in "Early.Prelims" to a space)?

Starting with UFC.261.Usman.vs.Masvidal.2.Prelims.576p.AVC.mkv the output should be UFC 261 Usman vs. Masvidal 2 (2021) 720p AVC {edition-Prelims}.mkv

Satrting with UFC.261.Usman.vs.Masvidal.2.Early.Prelims.576p.AVC.mkv should be UFC 261 Usman vs. Masvidal 2 (2021) 720p AVC {edition-Early Prelims}.mkv

I've got the rest of it, I just can't figure out how to automate the {edition-*******} part.

Tanks for any tips you can give.
TheFireNinja
Posts: 3
Joined: 08 Apr 2024, 01:04

Re: How can I add {edition-"words from file name"} to file?

Post by TheFireNinja »

I think I figured it out. I used the following and it seems to work as desired:

Groovy: Select all

{ ny.colon(' ') } {vf} {vc} 
{
	def ufc = fn.matchAll(/Prelims|Early.Prelims/)
	def edition = ufc.join(' ').replace('.':' ')
	'{edition-' + edition + '}'
}
User avatar
rednoah
The Source
Posts: 23006
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How can I add {edition-"words from file name"} to file?

Post by rednoah »

Here's how I'd write it:

Format: Select all

{ ny.colon(' ') } { vf } { vc } { '{edition-' + fn.match(/Prelims|Early.Prelims/).space(' ') + '}' }
:arrow: Match information from the file path
:idea: Please read the FAQ and How to Request Help.
TheFireNinja
Posts: 3
Joined: 08 Apr 2024, 01:04

Re: How can I add {edition-"words from file name"} to file?

Post by TheFireNinja »

rednoah wrote: 08 Apr 2024, 03:56 Here's how I'd write it:

Format: Select all

{ ny.colon(' ') } { vf } { vc } { '{edition-' + fn.match(/Prelims|Early.Prelims/).space(' ') + '}' }
:arrow: Match information from the file path
That makes sense and is much cleaner. Thanks for the reply. Showed me how to use the + symbol correctly.
Post Reply