1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-05 00:45:00 -05:00

Fix for scene exceptions error.

This commit is contained in:
echel0n 2014-06-30 06:36:20 -07:00
parent 4575c58348
commit 0e665cbbb2

View File

@ -52,34 +52,32 @@ def get_scene_exceptions(indexer_id, season=-1):
Given a indexer_id, return a list of all the scene exceptions. Given a indexer_id, return a list of all the scene exceptions.
""" """
exceptionsList = {} exceptionsList = []
myDB = db.DBConnection('cache.db') myDB = db.DBConnection('cache.db')
exceptions = myDB.select("SELECT show_name FROM scene_exceptions WHERE indexer_id = ? and season = ?", exceptions = myDB.select("SELECT show_name FROM scene_exceptions WHERE indexer_id = ? and season = ?",
[indexer_id, season]) [indexer_id, season])
if exceptions: if exceptions:
exceptionsList = list(set([cur_exception["show_name"] for cur_exception in exceptions])) exceptionsList = list(set([cur_exception["show_name"] for cur_exception in exceptions]))
if season == 1: # if we where looking for season 1 we can add generic names
exceptionsList += get_scene_exceptions(indexer_id, season=-1)
del exceptions if season == 1: # if we where looking for season 1 we can add generic names
exceptionsList += get_scene_exceptions(indexer_id, season=-1)
return exceptionsList return exceptionsList
def get_all_scene_exceptions(indexer_id): def get_all_scene_exceptions(indexer_id):
exceptionsList = {} exceptionsDict = {}
myDB = db.DBConnection('cache.db') myDB = db.DBConnection('cache.db')
exceptions = myDB.select("SELECT show_name,season FROM scene_exceptions WHERE indexer_id = ?", [indexer_id]) exceptions = myDB.select("SELECT show_name,season FROM scene_exceptions WHERE indexer_id = ?", [indexer_id])
if exceptions: if exceptions:
for cur_exception in exceptions: for cur_exception in exceptions:
if not cur_exception["season"] in exceptionsList: if not cur_exception["season"] in exceptionsDict:
exceptionsList[cur_exception["season"]] = [] exceptionsDict[cur_exception["season"]] = []
exceptionsList[cur_exception["season"]].append(cur_exception["show_name"]) exceptionsDict[cur_exception["season"]].append(cur_exception["show_name"])
del exceptions return exceptionsDict
return exceptionsList
def get_scene_seasons(indexer_id): def get_scene_seasons(indexer_id):
@ -127,9 +125,6 @@ def get_scene_exception_by_name_multiple(show_name):
logger.log(u"Scene exception lookup got indexer id " + str(cur_indexer_id) + u", using that", logger.DEBUG) logger.log(u"Scene exception lookup got indexer id " + str(cur_indexer_id) + u", using that", logger.DEBUG)
out.append((cur_indexer_id, cur_season)) out.append((cur_indexer_id, cur_season))
# cleanup
del all_exception_results
if out: if out:
return out return out
else: else: