Hacker News new | past | comments | ask | show | jobs | submit login

    Automagically resolves file names like "Eva.2011.R5.XviD.VaLeBo.mkv"
Out of curiosity, how? Regex matching? Does it miss a good amount of times or what?



Yeah mostly regex. Plus some heuristics. Works most of the times. Pretty efficient for the simple amount of heuristics it uses. You can see the code here https://github.com/legalosLOTR/mdb/blob/master/MDB/DBbuilder... Check out the function get_movie_name!


Wouldnt this break a movie like 2012?

    #2 remove year and stuff following it
    filename = re.sub('\d\d\d\d.*', ' ', filename)


Yeah it totally would! Thanks for pointing this out. Btw, I am planning to use another library that has better detection rates - https://github.com/wackou/guessit




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: