1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-14 12:02:21 -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> <td>Show_Name</td>
</tr> </tr>
<tr class="even"> <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>%AD</td>
<td>2010 03 09</td> <td>2010 03 09</td>
</tr> </tr>
@ -699,24 +699,24 @@
<td>Show_Name</td> <td>Show_Name</td>
</tr> </tr>
<tr class="even"> <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>%AD</td>
<td>9th Mar 2010</td> <td>9 Mar 2011</td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>%A.D</td> <td>%A.D</td>
<td>9th.Mar.2010</td> <td>9.Mar.2011</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td>&nbsp;</td> <td>&nbsp;</td>
<td>%A_D</td> <td>%A_D</td>
<td>9th_Mar_2010</td> <td>9_Mar_2011</td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>%A-D</td> <td>%A-D</td>
<td>9th-Mar-2010</td> <td>9-Mar-2011</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td class="align-right"><b>Episode Name:</b></td> <td class="align-right"><b>Episode Name:</b></td>
@ -776,7 +776,7 @@
<tr> <tr>
<td class="align-right"><i class="icon-info-sign" title="Multi-EP style is ignored"></i> <b>Release Name:</b></td> <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>%RN</td>
<td>Show.Name.9th.Mar.2010.HDTV.XviD-RLSGROUP</td> <td>Show.Name.9.Mar.2011.HDTV.XviD-RLSGROUP</td>
</tr> </tr>
<tr class="even"> <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> <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<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<parts>\d{1,3}\d{1,3}.*?)[. _-]+
(?P<event>.*?)[. _-]+ (?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_month>[a-zA-Z]{3,})[. _-]+
(?P<air_year>\d{4})[. _-]+ (?P<air_year>\d{4})[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+ (?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
@ -203,9 +203,9 @@ sports_regexs = [
('sports_event_without_parts', ('sports_event_without_parts',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group # 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<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_month>[a-zA-Z]{3,})[. _-]+
(?P<air_year>\d{4})[. _-]+ (?P<air_year>\d{4})[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+ (?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
@ -215,9 +215,20 @@ sports_regexs = [
('sports_parts_without_event', ('sports_parts_without_event',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group # 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<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_month>[a-zA-Z]{3,})[. _-]+
(?P<air_year>\d{4})[. _-]+ (?P<air_year>\d{4})[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+ (?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
@ -227,7 +238,7 @@ sports_regexs = [
('sports_bare', ('sports_bare',
# Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group # 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<parts>\d{1,3}\d{1,3}.*?)[. _-]+
(?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+ (?P<extra_info>.*?(?<![. _-])(?<!WEB))[. _-]+
(?P<release_group>.*?)$ (?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) logger.log(u"Trying to parse " + new_name, logger.DEBUG)
try: try:
result = parser.parse(new_name, regexMode) result = parser.parse(new_name)
except InvalidNameException: except InvalidNameException:
logger.log(u"Unable to parse " + new_name + ", not valid", logger.DEBUG) logger.log(u"Unable to parse " + new_name + ", not valid", logger.DEBUG)
return False return False
@ -187,8 +187,10 @@ def _generate_sample_ep(multi=None, abd=False, sports=False):
if abd: if abd:
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
elif sports: 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: else:
ep._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP' ep._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP'

View File

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

View File

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