# Author: Nic Wolfe # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickGear. # # SickGear is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # SickGear is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with SickGear. If not, see . # all regexes are case insensitive normal_regexes = [ ('garbage_name', ''' ^(?!\\bs?\\d+[ex]\\d+\\b)[a-zA-Z0-9]{3,}$ ''' ), ('standard_repeat', # Show.Name.S01E02.S01E03.Source.Quality.Etc-Group # Show Name - S01E02 - S01E03 - S01E04 - Ep Name ''' ^(?P.+?)[. _-]+ (?# Show_Name and separator) s(?P\d+)[. _-]* (?# S01 and optional separator) e(?P\d+) (?# E02 and separator) ([. _-]+s(?P=season_num)[. _-]* (?# S01 and optional separator) e(?P\d+))+ (?# E03/etc and separator) [. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('fov_repeat', # Show.Name.1x02.1x03.Source.Quality.Etc-Group # Show Name - 1x02 - 1x03 - 1x04 - Ep Name ''' ^(?P.+?)[. _-]+ (?# Show_Name and separator) (?P\d+)x (?# 1x) (?P\d+) (?# 02 and separator) ([. _-]+(?P=season_num)x (?# 1x) (?P\d+))+ (?# 03/etc and separator) [. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('non_standard_multi_ep', # Show Name - S01E02&03 - My Ep Name # Show Name - S01E02and03 - My Ep Name ''' ^((?P.+?)[. _-]+)? (?# Show_Name and separator) s(?P\d+)[. _-]* (?# S01 and optional separator) e(?P\d+) (?# E02 and separator) (([. _-]*and|&|to) (?# linking and/&/to) (?P(?!(2160|1080|720|480)[pi])\d+))+ (?# additional E03/etc) [. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('standard', # Show.Name.S01E02.Source.Quality.Etc-Group # Show Name - S01E02 - My Ep Name # Show.Name.S01.E03.My.Ep.Name # Show.Name.S01E02E03.Source.Quality.Etc-Group # Show Name - S01E02-03 - My Ep Name # Show.Name.S01.E02.E03 ''' ^((?P.+?)[. _-]+)? (?# Show_Name and separator) s(?P\d+)[. _-]* (?# S01 and optional separator) e(?P\d+) (?# E02 and separator) (([. _-]*e|-) (?# linking e/- char) (?P(?!(2160|1080|720|480)[pi])\d+))* (?# additional E03/etc) [. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('fov_non_standard_multi_ep', # Show Name - 1x02and03and04 - My Ep Name ''' ^((?P.+?)[\[. _-]+)? (?# Show_Name and separator) (?P\d+)x (?# 1x) (?P\d+) (?# 02 and separator) (([. _-]*and|&|to) (?# linking x/- char) (?P (?!(2160|1080|720|480)[pi])(?!(?<=x)264) (?# ignore obviously wrong multi-eps) \d+))+ (?# additional x03/etc) [\]. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('fov', # Show_Name.1x02.Source_Quality_Etc-Group # Show Name - 1x02 - My Ep Name # Show_Name.1x02x03x04.Source_Quality_Etc-Group # Show Name - 1x02-03-04 - My Ep Name ''' ^((?P.+?)[\[. _-]+)? (?# Show_Name and separator) (?P\d+)x (?# 1x) (?P\d+) (?# 02 and separator) (([. _-]*x|-) (?# linking x/- char) (?P (?!(2160|1080|720|480)[pi])(?!(?<=x)264) (?# ignore obviously wrong multi-eps) \d+))* (?# additional x03/etc) [\]. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('scene_date_format', # Show.Name.2010.11.23.Source.Quality.Etc-Group # Show Name - 2010-11-23 - Ep Name ''' ^((?P.+?)[. _-]+)? (?# Show_Name and separator) (?P\d{4})[. _-]+ (?# 2010 and separator) (?P\d{2})[. _-]+ (?# 11 and separator) (?P\d{2}) (?# 23 and separator) [. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('uk_date_format', # Show.Name.23.11.2010.Source.Quality.Etc-Group # Show Name - 23-11-2010 - Ep Name # Show Name - 14-08-17 - Ep Name # Show Name - 14 Jan 17 - Ep Name ''' ^((?P.+?)[. _-]+)? (?# Show_Name and separator) \(?(?P\d{2})[. _-]+ (?# 23 and separator) (?P(?:\d{2}|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\w*))[. _-]+ (?# 11 and separator) (?P(?:19|20)?\d{2})\)? (?# 2010 and separator) [. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('stupid', # tpz-abc102 ''' (?P.+?)-\w+?[\. ]? (?# tpz-abc) (?!264) (?# don't count x264) (?P\d{1,2}) (?# 1) (?P\d{2})$ (?# 02) ''' ), ('verbose', # Show Name Season 1 Episode 2 Ep Name ''' ^(?P.+?)[. _-]+ (?# Show Name and separator) season[. _-]+ (?# season and separator) (?P\d+)[. _-]+ (?# 1) episode[. _-]+ (?# episode and separator) (?P\d+)[. _-]+ (?# 02 and separator) (?P.+)$ (?# Source_Quality_Etc-) ''' ), ('season_only', # Show.Name.S01.Source.Quality.Etc-Group ''' ^((?P.+?)[. _-]+)? (?# Show_Name and separator) s(eason[. _-])? (?# S01/Season 01) (?P\d+)[. _-]* (?# S01 and optional separator) [. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('no_season_multi_ep', # Show.Name.E02-03 # Show.Name.E02.2010 ''' ^((?P.+?)[. _-]+)? (?# Show_Name and separator) (e(p(isode)?)?|part|pt)[. _-]? (?# e, ep, episode, or part) (?P(\d+|[ivx]+)) (?# first ep num) ((([. _-]+(and|&|to)[. _-]+)|-) (?# and/&/to joiner) (?P(?!(2160|1080|720|480)[pi])(\d+|[ivx]+))[. _-]) (?# second ep num) ([. _-]*(?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('no_season_general', # Show.Name.E23.Test # Show.Name.Part.3.Source.Quality.Etc-Group # Show.Name.Part.1.and.Part.2.Blah-Group ''' ^((?P.+?)[. _-]+)? (?# Show_Name and separator) (e(p(isode)?)?|part|pt)[. _-]? (?# e, ep, episode, or part) (?P(\d+|([ivx]+(?=[. _-])))) (?# first ep num) ([. _-]+((and|&|to)[. _-]+)? (?# and/&/to joiner) ((e(p(isode)?)?|part|pt)[. _-]?) (?# e, ep, episode, or part) (?P(?!(2160|1080|720|480)[pi]) (\d+|([ivx]+(?=[. _-]))))[. _-])* (?# second ep num) ([. _-]*(?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ('bare', # Show.Name.102.Source.Quality.Etc-Group ''' ^(?P.+?)[. _-]+ (?# Show_Name and separator) (?P\d{1,2}) (?# 1) (?P\d{2}) (?# 02 and separator) ([. _-]+(?P(?!\d{3}[. _-]+)[^-]+) (?# Source_Quality_Etc-) (-(?P.+))?)?$ (?# Group) ''' ), ('no_season', # Show Name - 01 - Ep Name # 01 - Ep Name ''' ^((?P.+?)(?:[. _-]{2,}|[. _]))? (?# Show_Name and separator) (?P\d{1,3}(?!\d)) (?# 01) (?:-(?P\d{1,3}(?!\d)))* (?# 02) (\s*(?:of)?\s*\d{1,3})? (?# of num eps) [. _-]+((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ] anime_regexes = [ ('anime_ultimate', ''' ^(?:\[(?P.+?)\][ ._-]*) (?P.+?)[ ._-]+ (?P\d{1,3}) (-(?P\d{1,3}))?[ ._-]+? (?:v(?P[0-9]))? (?:[\w\.]*) (?:(?:(?:[\[\(])(?P\d{3,4}[xp]?\d{0,4}[\.\w\s-]*)(?:[\]\)]))|(?:\d{3,4}[xp])) (?:[ ._]?\[(?P\w+)\])? .*? ''' ), ('anime_standard', # [Group Name] Show Name.13-14 # [Group Name] Show Name - 13-14 # Show Name 13-14 # [Group Name] Show Name.13 # [Group Name] Show Name - 13 # Show Name 13 ''' ^(\[(?P.+?)\][ ._-]*)? (?# Release Group and separator) (?P.+?)[ ._-]+ (?# Show_Name and separator) (?P\d{1,3}) (?# E01) (-(?P\d{1,3}))? (?# E02) (v(?P[0-9]))? (?# version) [ ._-]+\[(?P\d{3,4}[xp]?\d{0,4}.+?)\] (?# Source_Quality_Etc-) (\[(?P\w{8})\])? (?# CRC) .*? (?# Separator and EOL) ''' ), ('anime_standard_round', # [Stratos-Subs]_Infinite_Stratos_-_12_(1280x720_H.264_AAC)_[379759DB] # [ShinBunBu-Subs] Bleach - 02-03 (CX 1280x720 x264 AAC) ''' ^(\[(?P.+?)\][ ._-]*)? (?# Release Group and separator) (?P.+?)[ ._-]+ (?# Show_Name and separator) (?P\d{1,3}) (?# E01) (-(?P\d{1,3}))? (?# E02) (v(?P[0-9]))? (?# version) [ ._-]+\((?P(CX[ ._-]?)?\d{3,4}[xp]?\d{0,4}[\.\w\s-]*)\) (?# Source_Quality_Etc-) (\[(?P\w{8})\])? (?# CRC) .*? (?# Separator and EOL) ''' ), ('anime_slash', # [SGKK] Bleach 312v1 [720p/MKV] ''' ^(\[(?P.+?)\][ ._-]*)? (?# Release Group and separator) (?P.+?)[ ._-]+ (?# Show_Name and separator) (?P\d{1,3}) (?# E01) (-(?P\d{1,3}))? (?# E02) (v(?P[0-9]))? (?# version) [ ._-]+\[(?P\d{3,4}p) (?# Source_Quality_Etc-) (\[(?P\w{8})\])? (?# CRC) .*? (?# Separator and EOL) ''' ), ('anime_standard_codec', # [Ayako]_Infinite_Stratos_-_IS_-_07_[H264][720p][EB7838FC] # [Ayako] Infinite Stratos - IS - 07v2 [H264][720p][44419534] # [Ayako-Shikkaku] Oniichan no Koto Nanka Zenzen Suki Janain Dakara ne - 10 [LQ][h264][720p] [8853B21C] ''' ^(\[(?P.+?)\][ ._-]*)? (?# Release Group and separator) (?P.+?)[ ._]* (?# Show_Name and separator) ([ ._-]+-[ ._-]+[A-Z]+[ ._-]+)?[ ._-]+ (?# this will kick me in the butt one day) (?P\d{1,3}) (?# E01) (-(?P\d{1,3}))? (?# E02) (v(?P[0-9]))? (?# version) ([ ._-](\[\w{1,2}\])?\[[a-z][.]?\w{2,4}\])? (?# codec) [ ._-]*\[(?P(\d{3,4}[xp]?\d{0,4})?[\.\w\s-]*)\] (?# Source_Quality_Etc-) (\[(?P\w{8})\])? (?# CRC) .*? (?# Separator and EOL) ''' ), ('anime_and_normal', # Bleach - s16e03-04 - 313-314 # Bleach.s16e03-04.313-314 # Bleach s16e03e04 313-314 ''' ^(\[(?P.+?)\][ ._-]*)? (?P.+?)[ ._-]+ (?# start of string and series name and non optional separator) [sS](?P\d+)[. _-]* (?# S01 and optional separator) [eE](?P\d+) (?# episode E02) (([. _-]*e|-) (?# linking e/- char) (?P\d+))* (?# additional E03/etc) ([ ._-]{2,}|[ ._]+) (?# if "-" is used to separate at least something else has to be) (?# there ->{2,} "s16e03-04-313-314" wouldn't make sense any way) (?\d{1,3})(?!0p) (?# absolute number) (-(?P\d{1,3}))* (?# "-" as separator and additional absolute number, all optional) (v(?P[0-9]))? (?# the version e.g. "v2") .*? ''' ), ('anime_and_normal_x', # Bleach - s16e03-04 - 313-314 # Bleach.s16e03-04.313-314 # Bleach s16e03e04 313-314 ''' ^(?P.+?)[ ._-]+ (?# start of string and series name and non optional separator) (?P\d+)[. _-]* (?# S01 and optional separator) [xX](?P\d+) (?# episode E02) (([. _-]*e|-) (?# linking e/- char) (?P\d+))* (?# additional E03/etc) ([ ._-]{2,}|[ ._]+) (?# if "-" is used to separate at least something else has to be) (?# there ->{2,} "s16e03-04-313-314" wouldn't make sense any way) (?\d{1,3})(?!0p) (?# absolute number) (-(?P\d{1,3}))* (?# "-" as separator and additional absolute number, all optional) (v(?P[0-9]))? (?# the version e.g. "v2") .*? ''' ), ('anime_and_normal_reverse', # Bleach - 313-314 - s16e03-04 ''' ^(?P.+?)[ ._-]+ (?# start of string and series name and non optional separator) (?\d{1,3})(?!0p) (?# absolute number) (-(?P\d{1,3}))* (?# "-" as separator and additional absolute number, all optional) (v(?P[0-9]))? (?# the version e.g. "v2") ([ ._-]{2,}|[ ._]+) (?# if "-" is used to separate at least something else has to be) (?# there ->{2,} "s16e03-04-313-314" wouldn't make sense any way) [sS](?P\d+)[. _-]* (?# S01 and optional separator) [eE](?P\d+) (?# episode E02) (([. _-]*e|-) (?# linking e/- char) (?P\d+))* (?# additional E03/etc) .*? ''' ), ('anime_and_normal_front', # 165.Naruto Shippuuden.s08e014 ''' ^(?\d{1,3})(?!0p) (?# start of string and absolute number) (-(?P\d{1,3}))* (?# "-" as separator and additional absolute number, all optional) (v(?P[0-9]))?[ ._-]+ (?# the version e.g. "v2") (?P.+?)[ ._-]+ [sS](?P\d+)[. _-]* (?# S01 and optional separator) [eE](?P\d+) (([. _-]*e|-) (?# linking e/- char) (?P\d+))* (?# additional E03/etc) .*? ''' ), ('anime_ep_name', ''' ^(?:\[(?P.+?)\][ ._-]*) (?P.+?)[ ._-]+ (?\d{1,3})(?!0p) (-(?P\d{1,3}))*[ ._-]*? (?:v(?P[0-9])[ ._-]+?)? (?:.+?[ ._-]+?)? \[(?P\w+)\][ ._-]? (?:\[(?P\w{8})\])? .*? ''' ), ('anime_bare_ep', # One Piece - 102 # Show Name 123 - 001 ''' ^(?:\[(?P.+?)\][ ._-]*)? (?P.+?)[ ._-]+[ ._-]{2,} (?# Show_Name and min 2 char separator) (?\d{1,3})(?!0p) (?# 1/001, while avoiding H.264 and 1080p from being matched) (-(?P\d{1,3}))*[ ._-]* (?# 2/002) (?:v(?P[0-9]))? (?# v2) ''' ), ('anime_bare', # [ACX]_Wolf's_Spirit_001.mkv ''' ^(\[(?P.+?)\][ ._-]*)? (?P.+?)[ ._-]+ (?# Show_Name and separator) (?\d{3})(?!0p) (?# E01, while avoiding H.264 and 1080p from being matched) (-(?P\d{3}))* (?# E02) (v(?P[0-9]))? (?# v2) .*? (?# Separator and EOL) ''' ), ('standard', # Show.Name.S01E02.Source.Quality.Etc-Group # Show Name - S01E02 - My Ep Name # Show.Name.S01.E03.My.Ep.Name # Show.Name.S01E02E03.Source.Quality.Etc-Group # Show Name - S01E02-03 - My Ep Name # Show.Name.S01.E02.E03 ''' ^((?P.+?)[. _-]+)? (?# Show_Name and separator) s(?P\d+)[. _-]* (?# S01 and optional separator) e(?P\d+) (?# E02 and separator) (([. _-]*e|-) (?# linking e/- char) (?P(?!(2160|1080|720|480)[pi])\d+))* (?# additional E03/etc) [. _-]*((?P.+?) (?# Source_Quality_Etc-) ((?[^- ]+))?)?$ (?# Group) ''' ), ]