From 5c5b6f49e1a89090c46cc43bf7b908ceca8da2cd Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 23 Jun 2014 23:45:21 -0700 Subject: [PATCH] Fixed regex patterns for both show and release names. Fixed post-processing loop issue. --- sickbeard/name_parser/parser.py | 2 +- sickbeard/name_parser/regexes.py | 40 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index ad4dddf5..ac353d08 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -109,7 +109,7 @@ class NameParser(object): if not self.showObj and not self.naming_pattern: # Regex pattern to return the Show / Series Name regardless of the file pattern tossed at it, matched 53 show name examples from regexes.py - show_pattern = '''^(?:(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOG(P)))?(?:[0-9]+)?(?:\[(?:.+?)\][ ._-])?(?P.*?)(?:[ ._-])+?(?:Season|Part)?(?:.[eE][0-9][0-9]?)?(?:.?[sS]?[0-9][0-9]?)''' + show_pattern = '''((\[.*?\])|(\d+[\.-]))*[ _\.]?(?P.*?([ ._-](\d{4}))?)((([ ._-]+\d+)|([ ._-]+s\d{2}))|(\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))''' try: show_regex = re.compile(show_pattern, re.VERBOSE | re.IGNORECASE) except re.error, errormsg: diff --git a/sickbeard/name_parser/regexes.py b/sickbeard/name_parser/regexes.py index e4d74a5a..2816b3e3 100644 --- a/sickbeard/name_parser/regexes.py +++ b/sickbeard/name_parser/regexes.py @@ -30,7 +30,7 @@ normal_regexes = {'normal':[ e(?P\d+))+ # E03/etc and separator [. _-]*((?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # Group '''), ('fov_repeat', @@ -44,7 +44,7 @@ normal_regexes = {'normal':[ (?P\d+))+ # 03/etc and separator [. _-]*((?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # Group '''), ('standard', @@ -62,7 +62,7 @@ normal_regexes = {'normal':[ (?P(?!(1080|720|480)[pi])\d+))* # additional E03/etc [. _-]*((?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # Group '''), ('fov', @@ -80,7 +80,7 @@ normal_regexes = {'normal':[ \d+))* # additional x03/etc [\]. _-]*((?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # Group '''), ('scene_date_format', @@ -93,7 +93,7 @@ normal_regexes = {'normal':[ (?P\d{2}) # 23 and separator [. _-]*((?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # Group '''), ('stupid', @@ -124,7 +124,7 @@ normal_regexes = {'normal':[ (?P\d+)[. _-]* # S01 and optional separator [. _-]*((?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # Group ''' ), @@ -139,7 +139,7 @@ normal_regexes = {'normal':[ (?P(?!(1080|720|480)[pi])(\d+|[ivx]+))[. _-]) # second ep num ([. _-]*(?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # Group ''' ), @@ -157,20 +157,10 @@ normal_regexes = {'normal':[ (\d+|([ivx]+(?=[. _-]))))[. _-])* # second ep num ([. _-]*(?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # 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 @@ -181,9 +171,19 @@ normal_regexes = {'normal':[ (?:-(?P\d{1,2}))* # 02 [. _-]+((?P.+?) # Source_Quality_Etc- ((?[^- ]+))?)?$ # Group + -(?P[^- ]+([. _-]\[.*\])?))?)?$ # 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 + '''), ]} sports_regexs = {'sports':[ @@ -210,7 +210,7 @@ sports_regexs = {'sports':[ ((?P\.+)[. _-]+)? (?P(\d{4}[. _-]+\d{1,2}[. _-]+\d{1,2})|(\d{1,2}\w{2}[. _-]+\w+[. _-]+\d{4})) [. _-]*((?P.+?)((?[^- ]+))?)?$ + -(?P[^- ]+([. _-]\[.*\])?))?)?$ ''' ),