New to any type of coding

Any questions? Need some help?
Post Reply
Retrorat1
Posts: 7
Joined: 24 Feb 2021, 07:23

New to any type of coding

Post 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
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: New to any type of coding

Post 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.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: New to any type of coding

Post 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
Post Reply