How does filename parsing work?

Any questions? Need some help?
Post Reply
tehjrow
Posts: 4
Joined: 23 Mar 2015, 16:36

How does filename parsing work?

Post by tehjrow »

I'm writing a small program to check filenames and see if I have all the latest episodes. I'm wondering how you go about parsing the filenames. It seems like there could be so many Season number Episode number combinations to look out for EX:(S03E04, S3E4, Season 03 Episode 04, 3x04, 03x04, etc.). Do you just search the filename for all possible combinations or is there a better way to do it?
User avatar
rednoah
The Source
Posts: 23947
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How does filename parsing work?

Post by rednoah »

Long answer: It's VERY complicated and fine-tuned over years. Known SxE patterns are a reliable metric in the decision making logic, but if there's no SxE pattern matches it'll move on to other numeric similarity metrics.

Short answer: You can capture the most common SxE patterns with 2-3 patterns. FileBot uses 7 patterns.

Best answer: @see net.filebot.similarity.SeasonEpisodeMatcher


PS: Are you perhaps building something like this? viewtopic.php?f=8&t=1681
:idea: Please read the FAQ and How to Request Help.
tehjrow
Posts: 4
Joined: 23 Mar 2015, 16:36

Re: How does filename parsing work?

Post by tehjrow »

Holy crap, thanks!
tehjrow
Posts: 4
Joined: 23 Mar 2015, 16:36

Re: How does filename parsing work?

Post by tehjrow »

After digging into this more, i'm going to forge a sword with Regex written on it and kill myself with it.
User avatar
rednoah
The Source
Posts: 23947
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How does filename parsing work?

Post by rednoah »

Or just use Groovy with functions provided by FileBot: https://github.com/filebot/scripts/sear ... sodeNumber
:idea: Please read the FAQ and How to Request Help.
tehjrow
Posts: 4
Joined: 23 Mar 2015, 16:36

Re: How does filename parsing work?

Post by tehjrow »

rednoah wrote:Or just use Groovy with functions provided by FileBot: https://github.com/filebot/scripts/sear ... sodeNumber
I'm using C# so i'm not sure how easy that would be to integrate. The Regex expressions require a bit of tweaking to get them to work in C# as it it.
User avatar
rednoah
The Source
Posts: 23947
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How does filename parsing work?

Post by rednoah »

The Regex would be identical. But there's multiple expressions and some logic build around on effectively applying them. Whatever you're doing, if it's close to something FileBot does, It's probably easier with Groovy and hook into all the media parsing functions as required.
:idea: Please read the FAQ and How to Request Help.
Post Reply