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

Fix for sports naming patterns

This commit is contained in:
echel0n 2014-04-28 06:35:49 -07:00
parent ba660a1942
commit 160b4bc4cc
5 changed files with 38 additions and 33 deletions

View File

@ -522,7 +522,7 @@
<td>Show_Name</td>
</tr>
<tr class="even">
<td class="align-right"><b>Air-By-Date:</b></td>
<td class="align-right"><b>Regular Air Date:</b></td>
<td>%AD</td>
<td>2010 03 09</td>
</tr>
@ -699,24 +699,24 @@
<td>Show_Name</td>
</tr>
<tr class="even">
<td class="align-right"><b>Sports:</b></td>
<td class="align-right"><b>Sports Air Date:</b></td>
<td>%AD</td>
<td>9th Mar 2010</td>
<td>9 Mar 2011</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>%A.D</td>
<td>9th.Mar.2010</td>
<td>9.Mar.2011</td>
</tr>
<tr class="even">
<td>&nbsp;</td>
<td>%A_D</td>
<td>9th_Mar_2010</td>
<td>9_Mar_2011</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>%A-D</td>
<td>9th-Mar-2010</td>
<td>9-Mar-2011</td>
</tr>
<tr class="even">
<td class="align-right"><b>Episode Name:</b></td>
@ -776,7 +776,7 @@
<tr>
<td class="align-right"><i class="icon-info-sign" title="Multi-EP style is ignored"></i> <b>Release Name:</b></td>
<td>%RN</td>
<td>Show.Name.9th.Mar.2010.HDTV.XviD-RLSGROUP</td>
<td>Show.Name.9.Mar.2011.HDTV.XviD-RLSGROUP</td>
</tr>
<tr class="even">
<td class="align-right"><i class="icon-info-sign" title="'SiCKBEARD' is used in place of RLSGROUP if it could not be properly detected"></i> <b>Release Group:</b></td>

View File

@ -193,7 +193,7 @@ sports_regexs = [
^(?P<series_name>.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+
(?P<parts>\d{1,3}\d{1,3}.*?)[. _-]+
(?P<event>.*?)[. _-]+
(?P<air_day>\d{1,2}[a-zA-Z]{2})[. _-]+
(?P<air_day>\d{1,2}).+
(?P<air_month>[a-zA-Z]{3,})[. _-]+
(?P<air_year>\d{4})[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
@ -203,9 +203,9 @@ sports_regexs = [
('sports_event_without_parts',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group
'''
^(?P<series_name>.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+
^(?P<series_name>.*?)[. _-]+
(?P<event>.*?)[. _-]+
(?P<air_day>\d{1,2}[a-zA-Z]{2})[. _-]+
(?P<air_day>\d{1,2}).+
(?P<air_month>[a-zA-Z]{3,})[. _-]+
(?P<air_year>\d{4})[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
@ -215,9 +215,20 @@ sports_regexs = [
('sports_parts_without_event',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group
'''
^(?P<series_name>.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+
^(?P<series_name>.*?)[. _-]+
(?P<parts>\d{1,3}\d{1,3}.*?)[. _-]+
(?P<air_day>\d{1,2}[a-zA-Z]{2})[. _-]+
(?P<air_day>\d{1,2}).+
(?P<air_month>[a-zA-Z]{3,})[. _-]+
(?P<air_year>\d{4})[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
(?P<release_group>.*?)$
'''),
('sports_date_only',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group
'''
^(?P<series_name>.*?)[. _-]+
(?P<air_day>\d{1,2})[. _-]+
(?P<air_month>[a-zA-Z]{3,})[. _-]+
(?P<air_year>\d{4})[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
@ -227,7 +238,7 @@ sports_regexs = [
('sports_bare',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group
'''
^(?P<series_name>.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+
^(?P<series_name>.*?)[. _-]+
(?P<parts>\d{1,3}\d{1,3}.*?)[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
(?P<release_group>.*?)$

View File

@ -153,7 +153,7 @@ def validate_name(pattern, multi=None, file_only=False, abd=False, sports=False)
logger.log(u"Trying to parse " + new_name, logger.DEBUG)
try:
result = parser.parse(new_name, regexMode)
result = parser.parse(new_name)
except InvalidNameException:
logger.log(u"Unable to parse " + new_name + ", not valid", logger.DEBUG)
return False
@ -187,8 +187,10 @@ def _generate_sample_ep(multi=None, abd=False, sports=False):
if abd:
ep._release_name = 'Show.Name.2011.03.09.HDTV.XviD-RLSGROUP'
ep.show.air_by_date = 1
elif sports:
ep._release_name = 'Show.Name.09.03.2011.HDTV.XviD-RLSGROUP'
ep._release_name = 'Show.Name.9th.Mar.2011.HDTV.XviD-RLSGROUP'
ep.show.sports = 1
else:
ep._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'

View File

@ -1902,12 +1902,12 @@ class TVEpisode(object):
'%0XME': '%02d' % self.scene_episode,
'%RN': release_name(self.release_name),
'%RG': release_group(self.release_name),
'%AD': str(self.airdate).replace('-', ' '),
'%A.D': str(self.airdate).replace('-', '.'),
'%A_D': us(str(self.airdate)),
'%A-D': str(self.airdate),
'%AD': self.airdate.strftime('%d %b %Y') if self.show.sports else str(self.airdate).replace('-', ' '),
'%A.D': self.airdate.strftime('%d.%b.%Y') if self.show.sports else str(self.airdate).replace('-', '.'),
'%A_D': us(self.airdate.strftime('%d-%b-%Y')) if self.show.sports else us(str(self.airdate)),
'%A-D': self.airdate.strftime('%d-%b-%Y') if self.show.sports else str(self.airdate),
'%Y': str(self.airdate.year),
'%M': str(self.airdate.month),
'%M': self.airdate.strftime('%b') if self.show.sports else str(self.airdate.month),
'%D': str(self.airdate.day),
'%0M': '%02d' % self.airdate.month,
'%0D': '%02d' % self.airdate.day,
@ -2100,7 +2100,7 @@ class TVEpisode(object):
if self.show.air_by_date and sickbeard.NAMING_CUSTOM_ABD and not self.relatedEps:
pattern = sickbeard.NAMING_ABD_PATTERN
elif self.show.sports and sickbeard.NAMING_CUSTOM_SPORTS and not self.relatedEps:
pattern = sickbeard.NAMING_CUSTOM_SPORTS
pattern = sickbeard.NAMING_SPORTS_PATTERN
else:
pattern = sickbeard.NAMING_PATTERN

View File

@ -52,24 +52,16 @@ class XEMBasicTests(test.SickbeardTestDBCase):
self.loadFromDB()
show = sickbeard.helpers.findCertainShow(sickbeard.showList, 24749)
ep = show.getEpisode(21, 17)
ep.airdate = datetime.datetime.now()
ep_date_formated = ep.airdate.strftime('%b')
show_name = None
if show_name:
print 'good'
else:
print 'bad'
ep.airdate = datetime.date.today()
# parse the file name
parse_result = None
title = u'UFC 155 Dos Santos vs Velasquez 29th Dec 2012 HDTV x264-Sir Paul'
pattern = u'%SN - %A-D - %EN'
title = 'Show.Name.9th.Mar.2010.HDTV.XviD-RLSGROUP'
try:
myParser = NameParser(False, 1)
parse_result = myParser.parse(title, True)
except InvalidNameException:
print(u"Unable to parse the filename " + title + " into a valid episode")
print(u"Unable to parse the filename " + ep.name + " into a valid episode")
print parse_result