Page 1 of 1

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

Posted: 08 Apr 2024, 01:20
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.

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

Posted: 08 Apr 2024, 02:55
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 + '}'
}

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

Posted: 08 Apr 2024, 03:56
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

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

Posted: 10 Apr 2024, 03:08
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.