English > Support

File Scanner and Regular Expressions

<< < (2/18) > >>

patch:
Some of my TV series are named without a letter designating series & episode eg for Avatar http://www.imdb.com/title/tt0417299/ Series 2 episode 1 is named
Avatar.The.Last.Airbender.-.201_The_Avatar_State_[Moonsong].avi

The scanner assigns it to series 1 episode 201

Has any one found a way to support this form of series numbering or should I rename my files?

rick.ca:
(?i)^.*\\(?P<title>.*)(s|\b)(?P<season>[0-9]{1})(?P<episode>[0-9]{2}) works.

This regex stuff is going to make my head explode. I found this by trial and error, so I still don't have a clue what most of this means. I started with one of the default expressions, in which I guessed "[0-9]{1,3}" meant match "1 to 3 digits." So I changed that to "match 1 digit for season and then 2 digits for episode."

Now I'm going to lose sleep dreaming about all the ways this won't work. Series with more than 9 seasons, seasons with more than 99 episodes, another 3-digit number later in the filename, the "201" not delimited the way it is...

Who's going to be our regex guru? :-\

patch:

--- Quote from: rick.ca on February 21, 2009, 11:10:08 am ---(?i)^.*\\(?P<title>.*)(s|\b)(?P<season>[0-9]{1})(?P<episode>[0-9]{2}) works.
--- End quote ---

Thanks rick.ca this worked well for me.


--- Quote from: rick.ca on February 21, 2009, 11:10:08 am ---Now I'm going to lose sleep dreaming about all the ways this won't work. Series with more than 9 seasons, seasons with more than 99 episodes, another 3-digit number later in the filename, the "201" not delimited the way it is...

--- End quote ---
Yep like how should we handle "Beverly Hills, 90210" http://www.imdb.com/title/tt0098749/ currently my file name is
Beverly.Hills.90210.S01E01.Class.Of.Beverly.Hills.avi

Looks like an early rule finding S<season>[0-9]{1-2}E<episode>[0-9]{2} which takes everything prior to this as the series title would work. "S" & "E" need to be upper or lower case.

Looks like I'm going to need to learn to read regex but it looks like hieroglyphics to me.

Would also like to use more of the path information if possible as I generally file my TV series as
Series title/s1/ etc

But perhaps I'm just going to have to make sure  my file names correspond to some standard

nostra:
Have you took a look at the link I provided above: http://www.regular-expressions.info/tutorial.html
There is everything you need to know about regex, good explained...

rick.ca:

--- Quote ---There is everything you need to know about regex
--- End quote ---

Yes, perhaps it will serve well as our regex guru. :)  It made my brain hurt the first time I looked, but now I see I can use it to figure things out fairly quickly. For example...


--- Quote ---"S" & "E" need to be upper or lower case.
--- End quote ---

(?i) turns on case insensitivity mode.


--- Quote ---Would also like to use more of the path information
--- End quote ---

That can be done by matching the "\" (i.e., that which denotes a directory). But the backslash is the escape character used to designate special characters—so it's matched with "\\". Note that is used multiple times in the default expressions for handling movies. The ^.*\\ in my expression means "match any number of any characters from the start of the string to '\'". So my guess is the required expression might be something like this:

(?i)^.*\\(?P<title>.*)\\(s|\b)(?P<season>[0-9]{1,2})\\(?P<episode>[0-9]{1,2}).?-.?(?P<eptitle>\w*\b)


--- Quote ---?P<title>, ?P<season>
--- End quote ---

Recognizing the PVD field names, I understood what these were doing—but not how. Now I understand that which is inside "()" is a "group" which is "captured." ?P<name> names a group, which would otherwise just be numbered from left to right. This obviously determines how data is passed back to the program.

Nostra, are any fields other than title, season, episode and eptitle supported. For example, can I make an expressions to capture things like year, director, rating from filenames?

[Edit] Oops, I see year in one of them. Maybe more to the point: Can any fields be used, or just the ones you've provided for?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version