Page 1 of 1

New to any type of coding

Posted: 30 Apr 2022, 23:21
by Retrorat1
Hi,
Sorry if this has been asked anywhere else but I have been searching and couldnt find an answer.

I have been looking at ways to take parts of the file name and make a new one that will work with The Sports DB this is one example

EPL 2009 Aston Villa vs Wigan 08 14 720pEN60fps WhAma.mp4 this is the file i have and I need to extract certain bits from the file name and discard the rest to make it look like this
English.Premier.League.2009-08-14.Aston.Villa.vs.Wigan

So EPL - English.Premier.League
2009 - 2009-08-14
Aston Villa - Aston.Villa
Wigan - Wigan
702p onwards get deleted.

Is there a way to do it? basically I am looking at splitting the file name (EPL) (2009) (Aston Villa) vs (Wigan) (08) (14) (720pEN60fps WhAma).mp4 so (a)(b)(c)(d)(d)(e)(f)(g) where (a) becomes English.Premier.League
so the corresponding file will look something like this (a).(b)-(e)-(f).(c).vs.(d)

LoL does this even make sense is it feasible or am I just a hope full wisher.
Thanks

P.S It might not be as complicated as I have made it look but this is coming from very basic understanding on how Regex works

Re: New to any type of coding

Posted: 01 May 2022, 10:14
by rednoah
Plain File Mode is what you're looking for and you can copy & paste some code from there to get started:
viewtopic.php?t=2072


:!: You will need to write your own code to interpret your specific file paths though, so that might be tricky if you're not familiar with programming or regular expressions.

Re: New to any type of coding

Posted: 03 May 2022, 12:36
by kim
To get you started ;)

Code: Select all

{fn.replaceAll(/(\w+).((?:19|20)\d{2}).(.+.vs.\w+).(\d{2}).(\d{2}).(\d{3}p)(.+)/, '$1 $2-$4-$5 $3').replace('EPL','English Premier League').space('.')}
sample:
English.Premier.League.2009-08-14.Aston.Villa.vs.Wigan

https://regexr.com/6krvi