Jump to content

Updated regex for multi episode


Recommended Posts

SilentException
Posted

According to media naming guidelines, multi-episodes can be named like this:

 

show name S01x02.S01x03 episode name.avi

 

But no regular expression from the code actually catches this pattern.

 

So I updated last two items in MultipleEpisodeExpressions array in MediaBrowser / MediaBrowser.Controller / Library / TVUtils.cs

 

.*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})(?=[xXeE])[xX]?[eE]?(?<epnumber>\d{1,3})((\.|\s|-| - )?([sS]\k<seasonnumber>)?(?=[xXeE])[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$
.*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})(?=[xXeE])[xX]?[eE]?(?<epnumber>\d{1,3})(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$

 

They should catch S01E02.S01E03 patterns as well, which I think is added benefit.

 

Better, worse, thoughts? :)

 

 

Posted

do the unit tests still pass?

SilentException
Posted (edited)

Sorry Luke, I haven't yet been able to set up fork and a dev environment so at this point I simply don't know :X

 

I have new machine at work but had no time to install and set up Visual Studio yet...

 

I was however doing extensive testing using names from the guidelines and few of my own.

Edited by SilentException
Posted

well if you do find time let me know. i actually have an idea for these naming convention functions that i think would be helpful to not only us, but other .net based apps as well.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...