How does filename parsing work?
How does filename parsing work?
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?
Re: How does filename parsing work?
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
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
Re: How does filename parsing work?
Holy crap, thanks!
Re: How does filename parsing work?
After digging into this more, i'm going to forge a sword with Regex written on it and kill myself with it.
Re: How does filename parsing work?
Or just use Groovy with functions provided by FileBot: https://github.com/filebot/scripts/sear ... sodeNumber
Re: How does filename parsing work?
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.rednoah wrote:Or just use Groovy with functions provided by FileBot: https://github.com/filebot/scripts/sear ... sodeNumber
Re: How does filename parsing work?
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.