Fix for failed downloads and improper storing of release name in db

This commit is contained in:
echel0n 2014-05-13 09:30:25 -07:00
parent cd77da5b60
commit f78ed64878
2 changed files with 16 additions and 18 deletions

View File

@ -104,6 +104,8 @@ def hasFailed(release, size, provider="%"):
is found with any provider.
"""
release = prepareFailedName(release)
myDB = db.DBConnection("failed.db")
sql_results = myDB.select(
"SELECT * FROM failed WHERE release=? AND size=? AND provider LIKE ?",
@ -136,9 +138,6 @@ def revertEpisode(epObj):
except EpisodeNotFoundException, e:
logger.log(u"Unable to create episode, please set its status manually: " + ex(e),
logger.WARNING)
return
def markFailed(epObj):
log_str = u""
@ -161,7 +160,6 @@ def logSnatch(searchResult):
logDate = datetime.datetime.today().strftime(dateFormat)
release = prepareFailedName(searchResult.name)
providerClass = searchResult.provider
if providerClass is not None:
provider = providerClass.name
@ -192,7 +190,6 @@ def trimHistory():
myDB.action("DELETE FROM history WHERE date < " + str(
(datetime.datetime.today() - datetime.timedelta(days=30)).strftime(dateFormat)))
def findRelease(epObj):
"""
Find releases in history by show ID and season.

View File

@ -515,22 +515,23 @@ def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manua
continue
result = pickBestResult(foundResults[provider.name][curEp], show)
finalResults.append(result)
if result:
finalResults.append(result)
logger.log(u"Checking if we should snatch " + result.name, logger.DEBUG)
any_qualities, best_qualities = Quality.splitQuality(show.quality)
logger.log(u"Checking if we should snatch " + result.name, logger.DEBUG)
any_qualities, best_qualities = Quality.splitQuality(show.quality)
# if there is a redownload that's higher than this then we definitely need to keep looking
if best_qualities and result.quality == max(best_qualities):
logger.log(u"Found a highest quality archive match to snatch [" + result.name + "]", logger.DEBUG)
queueItem.results = [result]
return queueItem
# if there is a redownload that's higher than this then we definitely need to keep looking
if best_qualities and result.quality == max(best_qualities):
logger.log(u"Found a highest quality archive match to snatch [" + result.name + "]", logger.DEBUG)
queueItem.results = [result]
return queueItem
# if there's no redownload that's higher (above) and this is the highest initial download then we're good
elif any_qualities and result.quality in any_qualities:
logger.log(u"Found a initial quality match to snatch [" + result.name + "]", logger.DEBUG)
queueItem.results = [result]
return queueItem
# if there's no redownload that's higher (above) and this is the highest initial download then we're good
elif any_qualities and result.quality in any_qualities:
logger.log(u"Found a initial quality match to snatch [" + result.name + "]", logger.DEBUG)
queueItem.results = [result]
return queueItem
# remove duplicates and insures snatch of highest quality from results
for i1, result1 in enumerate(finalResults):