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

Fixed issues with finding propers to many keywords.

Fixed issues with scene numbering when searching for propers.
This commit is contained in:
echel0n 2014-04-28 18:25:27 -07:00
parent dc867d049b
commit 7f44a2cfad
5 changed files with 14 additions and 8 deletions

View File

@ -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()

View File

@ -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'

View File

@ -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(

View File

@ -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),

View File

@ -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)