From 7f44a2cfadd17d0b6a968aa946b0c9891585684c Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 28 Apr 2014 18:25:27 -0700 Subject: [PATCH] Fixed issues with finding propers to many keywords. Fixed issues with scene numbering when searching for propers. --- sickbeard/name_parser/parser.py | 2 +- sickbeard/naming.py | 2 +- sickbeard/properFinder.py | 8 +++++++- sickbeard/tv.py | 8 ++++---- tests/xem_tests.py | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 3c0cd28c..3a8e41c8 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -140,7 +140,7 @@ class NameParser(object): try: if 'sports' in cur_regex_name: dtStr = '%s-%s-%s' % (day, month, year) - result.air_date = result.sports_date = datetime.datetime.strptime(dtStr, "%d-%b-%Y").date() + result.air_date = result.sports_date = datetime.datetime.strptime(dtStr, "%Y-%b-%d").date() else: dtStr = '%s-%s-%s' % (year, month, day) result.air_date = datetime.datetime.strptime(dtStr, "%Y-%m-%d").date() diff --git a/sickbeard/naming.py b/sickbeard/naming.py index a17f0279..d998209d 100644 --- a/sickbeard/naming.py +++ b/sickbeard/naming.py @@ -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.9th.Mar.2011.HDTV.XviD-RLSGROUP' + ep._release_name = 'Show.Name.2011.Mar.9th.HDTV.XviD-RLSGROUP' ep.show.sports = 1 else: ep._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP' diff --git a/sickbeard/properFinder.py b/sickbeard/properFinder.py index 842fbeae..31409098 100644 --- a/sickbeard/properFinder.py +++ b/sickbeard/properFinder.py @@ -100,7 +100,7 @@ class ProperFinder(): # parse the file name try: myParser = NameParser(False) - parse_result = myParser.parse(curProper.name, True) + parse_result = myParser.parse(curProper.name) except InvalidNameException: logger.log(u"Unable to parse the filename " + curProper.name + " into a valid episode", logger.DEBUG) continue @@ -121,6 +121,7 @@ class ProperFinder(): else: curProper.season = parse_result.season_number if parse_result.season_number != None else 1 curProper.episode = parse_result.episode_numbers[0] + curProper.quality = Quality.nameQuality(curProper.name) # for each show in our list @@ -197,6 +198,11 @@ class ProperFinder(): logger.log(u"Unable to find episode with date " + str( curProper.episode) + " for show " + parse_result.series_name + ", skipping", logger.WARNING) continue + else: + # items stored in cache are scene numbered, convert before lookups + epObj = showObj.getEpisode(curProper.season, curProper.episode, sceneConvert=True) + curProper.season = epObj.season + curProper.episode = epObj.episode # check if we actually want this proper (if it's the right quality) sqlResults = db.DBConnection().select( diff --git a/sickbeard/tv.py b/sickbeard/tv.py index bd49b5e3..4e4832b7 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -1912,10 +1912,10 @@ class TVEpisode(object): '%0XME': '%02d' % self.scene_episode, '%RN': release_name(self.release_name), '%RG': release_group(self.release_name), - '%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), + '%AD': self.airdate.strftime('%Y-%b-%d') if self.show.sports else str(self.airdate).replace('-', ' '), + '%A.D': self.airdate.strftime('%Y-%b-%d') if self.show.sports else str(self.airdate).replace('-', '.'), + '%A_D': us(self.airdate.strftime('%Y-%b-%d')) if self.show.sports else us(str(self.airdate)), + '%A-D': self.airdate.strftime('%Y-%b-%d') if self.show.sports else str(self.airdate), '%Y': str(self.airdate.year), '%M': self.airdate.strftime('%b') if self.show.sports else str(self.airdate.month), '%D': str(self.airdate.day), diff --git a/tests/xem_tests.py b/tests/xem_tests.py index 4b01f075..3463c0a4 100644 --- a/tests/xem_tests.py +++ b/tests/xem_tests.py @@ -57,7 +57,7 @@ class XEMBasicTests(test.SickbeardTestDBCase): # parse the file name pattern = u'%SN - %A-D - %EN' - title = 'Pawn.Stars.S08E56.HDTV.XviD-RLSGROUP' + title = 'UFC.166.Velasquez.v.Dos Santos.III.19th.Oct.2013.HDTV.x264-Sir.Paul' try: myParser = NameParser(False, -1) parse_result = myParser.parse(title)