Skip to content

Instantly share code, notes, and snippets.

@keis
Created August 20, 2014 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keis/13e5753fc98a01d9acbc to your computer and use it in GitHub Desktop.
Save keis/13e5753fc98a01d9acbc to your computer and use it in GitHub Desktop.
or maybe monster regexp?
matcher = re.compile(r'''^
(?:(?P<prefix>\[.*\])\s+)?
(?P<name>.+?)
([._ ](?P<year>[0-9]{4}))?
([. ]
(?:(
[Ss](?P<season>[0-9]+)
(
[Ee](?P<episode>[0-9]+)
)?
)|(
(?P<season_a>[0-9]+)x(?P<episode_a>[0-9]+)
)|(
(?P<special>
(?:Christmas.Special.[0-9]{4})|
(?:[0-9]{4}.Christmas.Special)|
(?:[0-9]{2}th.Anniversary.Special)|
(?:Special)
)
[._]?
))
(?P<episode_name>.*?)
)?
(?P<moviepack>MOViE.PACK|Movie.Pack)?
(?:
\[(?P<tagsb>[^\]]*)\]|
(?P<tags>
(?:[._ ]?
(?:
[xX]264|
[0-9]{3,4}p|
[0-9]{4}|
AC3|
DTS|
HDTV|
PDTV|
BluRay|
BRRip|
DVDRip|
XviD|
XVID|
DD5\.1|
3D)
)+
(?:[.]
(?:[a-zA-Z0-9]{1,5})
)*
)
)?
(
\.avi|
_?-_?(?P<group>[^-]{2,18})|
\s?{(?P<groupb>.*)}|
\s[A-Zi]+
)$
''', re.VERBOSE).match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment