diff --git a/gui/slick/interfaces/default/config_postProcessing.tmpl b/gui/slick/interfaces/default/config_postProcessing.tmpl index fe45f6f4..3bc218ab 100644 --- a/gui/slick/interfaces/default/config_postProcessing.tmpl +++ b/gui/slick/interfaces/default/config_postProcessing.tmpl @@ -522,7 +522,7 @@ Show_Name - Air-By-Date: + Regular Air Date: %AD 2010 03 09 @@ -699,24 +699,24 @@ Show_Name - Sports: + Sports Air Date: %AD - 9th Mar 2010 + 9 Mar 2011   %A.D - 9th.Mar.2010 + 9.Mar.2011   %A_D - 9th_Mar_2010 + 9_Mar_2011   %A-D - 9th-Mar-2010 + 9-Mar-2011 Episode Name: @@ -776,7 +776,7 @@ Release Name: %RN - Show.Name.9th.Mar.2010.HDTV.XviD-RLSGROUP + Show.Name.9.Mar.2011.HDTV.XviD-RLSGROUP Release Group: diff --git a/sickbeard/name_parser/regexes.py b/sickbeard/name_parser/regexes.py index 78b17d68..3697b77b 100644 --- a/sickbeard/name_parser/regexes.py +++ b/sickbeard/name_parser/regexes.py @@ -193,7 +193,7 @@ sports_regexs = [ ^(?P.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+ (?P\d{1,3}\d{1,3}.*?)[. _-]+ (?P.*?)[. _-]+ - (?P\d{1,2}[a-zA-Z]{2})[. _-]+ + (?P\d{1,2}).+ (?P[a-zA-Z]{3,})[. _-]+ (?P\d{4})[. _-]+ (?P.*?(?.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+ + ^(?P.*?)[. _-]+ (?P.*?)[. _-]+ - (?P\d{1,2}[a-zA-Z]{2})[. _-]+ + (?P\d{1,2}).+ (?P[a-zA-Z]{3,})[. _-]+ (?P\d{4})[. _-]+ (?P.*?(?.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+ + ^(?P.*?)[. _-]+ (?P\d{1,3}\d{1,3}.*?)[. _-]+ - (?P\d{1,2}[a-zA-Z]{2})[. _-]+ + (?P\d{1,2}).+ (?P[a-zA-Z]{3,})[. _-]+ (?P\d{4})[. _-]+ (?P.*?(?.*?)$ '''), + ('sports_date_only', + # Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group + ''' + ^(?P.*?)[. _-]+ + (?P\d{1,2})[. _-]+ + (?P[a-zA-Z]{3,})[. _-]+ + (?P\d{4})[. _-]+ + (?P.*?(?.*?)$ + '''), + ('sports_bare', # Show.Name.Event.Nov.23rd.2010.Source.Quality.Etc-Group ''' - ^(?P.*?(UEFA|MLB|ESPN|WWE|MMA|UFC|TNA|EPL|NASCAR|NBA|NFL|NHL|NRL|PGA|SUPER LEAGUE|FORMULA|FIFA|NETBALL|MOTOGP).*?)[. _-]+ + ^(?P.*?)[. _-]+ (?P\d{1,3}\d{1,3}.*?)[. _-]+ (?P.*?(?.*?)$ diff --git a/sickbeard/naming.py b/sickbeard/naming.py index 39a4cf61..a17f0279 100644 --- a/sickbeard/naming.py +++ b/sickbeard/naming.py @@ -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' diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 36171b6b..279fa743 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -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 diff --git a/tests/xem_tests.py b/tests/xem_tests.py index e1ae2b23..67d8bdff 100644 --- a/tests/xem_tests.py +++ b/tests/xem_tests.py @@ -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