1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 11:32:20 -05:00

Fix for sports naming pattern issues, finally this is resolved!

Fixes issues for air-by-date shows as well.
This commit is contained in:
echel0n 2014-04-29 16:44:08 -07:00
parent 2893b3331e
commit a97dcad291
3 changed files with 12 additions and 16 deletions

View File

@ -128,22 +128,17 @@ class NameParser(object):
result.episode_numbers = [ep_num] result.episode_numbers = [ep_num]
if 'air_year' in named_groups and 'air_month' in named_groups and 'air_day' in named_groups: 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'))
year = int(match.group('air_year')) month = match.group('air_month')
month = match.group('air_month') day = int(match.group('air_day'))
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'))
try: try:
if 'sports' in cur_regex_name: try:
dtStr = '%s-%s-%s' % (year, month, day)
result.air_date = result.sports_date = datetime.datetime.strptime(dtStr, "%Y-%b-%d").date()
else:
dtStr = '%s-%s-%s' % (year, month, day) dtStr = '%s-%s-%s' % (year, month, day)
result.air_date = datetime.datetime.strptime(dtStr, "%Y-%m-%d").date() 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: except ValueError, e:
raise InvalidNameException(e.message) raise InvalidNameException(e.message)

View File

@ -190,8 +190,9 @@ sports_regexs = [
('sports_event', ('sports_event',
# Show.Name.123.Event.Nov.23rd.2010.Source.Quality.Etc-Group # Show.Name.123.Event.Nov.23rd.2010.Source.Quality.Etc-Group
''' '''
/////////////////////p,.l.................. ^((?P<series_name>.+?)[. _-]+)? ^((?P<series_name>.+?)[. _-]+)?
((?P<air_day>\d{1,2}).+)[. _-]+ ^((?P<event>.+?)[. _-]+)?
((?P<air_day>\d{1,2}))[. _-]+
(?P<air_month>\w{3,})[. _-]+ (?P<air_month>\w{3,})[. _-]+
(?P<air_year>\d{4}) (?P<air_year>\d{4})
[. _-]*((?P<extra_info>.+?) [. _-]*((?P<extra_info>.+?)

View File

@ -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) logger.log(u"Air date incorrect in parsed episode, pattern isn't valid", logger.DEBUG)
return False return False
elif sports: 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) logger.log(u"Sports air date incorrect in parsed episode, pattern isn't valid", logger.DEBUG)
return False return False
else: 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._release_name = 'Show.Name.2011.03.09.HDTV.XviD-RLSGROUP'
ep.show.air_by_date = 1 ep.show.air_by_date = 1
elif sports: 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 ep.show.sports = 1
else: else:
ep._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP' ep._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'