diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 830d7e5b..f2fe09b1 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -128,22 +128,17 @@ class NameParser(object): result.episode_numbers = [ep_num] if 'air_year' in named_groups and 'air_month' in named_groups and 'air_day' in named_groups: - if 'sports' in cur_regex_name: - year = int(match.group('air_year')) - month = match.group('air_month') - day = int(re.sub("(st|nd|rd|th)", "", match.group('air_day'))) - else: - year = int(match.group('air_year')) - month = int(match.group('air_month')) - day = int(match.group('air_day')) + year = int(match.group('air_year')) + month = match.group('air_month') + day = int(match.group('air_day')) try: - if 'sports' in cur_regex_name: - dtStr = '%s-%s-%s' % (year, month, day) - result.air_date = result.sports_date = datetime.datetime.strptime(dtStr, "%Y-%b-%d").date() - else: + try: dtStr = '%s-%s-%s' % (year, month, day) result.air_date = datetime.datetime.strptime(dtStr, "%Y-%m-%d").date() + except: + dtStr = '%s-%s-%s' % (day, month, year) + result.air_date = datetime.datetime.strptime(dtStr, "%d-%b-%Y").date() except ValueError, e: raise InvalidNameException(e.message) diff --git a/sickbeard/name_parser/regexes.py b/sickbeard/name_parser/regexes.py index d76ed2ae..4e5be696 100644 --- a/sickbeard/name_parser/regexes.py +++ b/sickbeard/name_parser/regexes.py @@ -190,8 +190,9 @@ sports_regexs = [ ('sports_event', # Show.Name.123.Event.Nov.23rd.2010.Source.Quality.Etc-Group ''' -/////////////////////p,.l.................. ^((?P.+?)[. _-]+)? - ((?P\d{1,2}).+)[. _-]+ + ^((?P.+?)[. _-]+)? + ^((?P.+?)[. _-]+)? + ((?P\d{1,2}))[. _-]+ (?P\w{3,})[. _-]+ (?P\d{4}) [. _-]*((?P.+?) diff --git a/sickbeard/naming.py b/sickbeard/naming.py index 4bd52fb1..26762c0e 100644 --- a/sickbeard/naming.py +++ b/sickbeard/naming.py @@ -165,7 +165,7 @@ def validate_name(pattern, multi=None, file_only=False, abd=False, sports=False) logger.log(u"Air date incorrect in parsed episode, pattern isn't valid", logger.DEBUG) return False elif sports: - if result.sports_date != ep.airdate: + if result.air_date != ep.airdate: logger.log(u"Sports air date incorrect in parsed episode, pattern isn't valid", logger.DEBUG) return False else: @@ -189,7 +189,7 @@ def _generate_sample_ep(multi=None, abd=False, sports=False): ep._release_name = 'Show.Name.2011.03.09.HDTV.XviD-RLSGROUP' ep.show.air_by_date = 1 elif sports: - ep._release_name = 'Show.Name.2011.Mar.09.HDTV.XviD-RLSGROUP' + ep._release_name = 'Show.Name.09.Mar.2011.HDTV.XviD-RLSGROUP' ep.show.sports = 1 else: ep._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'