1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 03:22:22 -05:00

Added incomplete indexer <-> scene mapping check

This commit is contained in:
echel0n 2014-05-11 15:24:02 -07:00
parent 48b4abffa5
commit 52efb6f43b
3 changed files with 24 additions and 9 deletions

View File

@ -247,7 +247,7 @@
#if (epResult["season"], epResult["episode"]) in $xem_numbering:
#set ($dfltSeas, $dfltEpis) = $xem_numbering[(epResult["season"], epResult["episode"])]
#else
#set ($dfltSeas, $dfltEpis) = (epResult["season"], epResult["episode"])
#set ($dfltSeas, $dfltEpis) = (0,0)
#end if
#if (epResult["season"], epResult["episode"]) in $scene_numbering:
#set ($scSeas, $scEpis) = $scene_numbering[(epResult["season"], epResult["episode"])]

View File

@ -240,10 +240,15 @@ class GenericProvider:
# self.cache.updateCache()
for epObj in episodes:
#cacheResult = self.cache.searchCache(epObj, manualSearch)
#if len(cacheResult):
# results.update(cacheResult)
# continue
cacheResult = self.cache.searchCache(epObj, manualSearch)
if len(cacheResult):
results.update(cacheResult)
continue
if not epObj.show.air_by_date:
if epObj.scene_season == 0 or epObj.scene_episode == 0:
logger.log(u"Incomplete Indexer <-> Scene mapping detected for " + epObj.prettyName() + ", skipping search!")
continue
if seasonSearch:
for curString in self._get_season_search_strings(epObj):
@ -274,10 +279,7 @@ class GenericProvider:
# parse the file name
try:
myParser = NameParser(False)
if ep_obj.season == ep_obj.scene_season and ep_obj.episode == ep_obj.scene_episode:
parse_result = myParser.parse(title)
else:
parse_result = myParser.parse(title).convert()
parse_result = myParser.parse(title).convert()
except InvalidNameException:
logger.log(u"Unable to parse the filename " + title + " into a valid episode", logger.WARNING)
continue

View File

@ -185,11 +185,24 @@ def find_xem_numbering(indexer_id, indexer, season, episode):
_xem_refresh(indexer_id, indexer)
cacheDB = db.DBConnection('cache.db')
myDB = db.DBConnection()
rows = cacheDB.select(
"SELECT scene_season, scene_episode FROM xem_numbering WHERE indexer = ? and indexer_id = ? and season = ? and episode = ?",
[indexer, indexer_id, season, episode])
scene_seasons = cacheDB.select(
"SELECT COUNT(DISTINCT scene_season) as count FROM xem_numbering WHERE indexer = ? and indexer_id = ?",
[indexer, indexer_id])
indexer_seasons = myDB.select(
"SELECT COUNT(DISTINCT season) as count FROM tv_episodes WHERE indexer = ? and showid = ?",
[indexer, indexer_id])
if rows:
return (int(rows[0]["scene_season"]), int(rows[0]["scene_episode"]))
elif int(scene_seasons[0]["count"]) > 0 and int(indexer_seasons[0]["count"]) > int(scene_seasons[0]["count"]):
return (0,0)
else:
return None