This fixes all failed download issues

This commit is contained in:
echel0n 2014-05-19 12:20:33 -07:00
parent a12085cbfc
commit d616ca2298
2 changed files with 32 additions and 28 deletions

View file

@ -393,6 +393,8 @@ def delete_dir(processPath):
def get_path_dir_files(dirName, nzbName, type):
path, dirs, files = None
if dirName == sickbeard.TV_DOWNLOAD_DIR and not nzbName or type == "manual": #Scheduled Post Processing Active
#Get at first all the subdir in the dirName
for path, dirs, files in ek.ek(os.walk, dirName):
@ -416,6 +418,8 @@ def process_failed(dirName, nzbName):
global returnStr
if sickbeard.USE_FAILED_DOWNLOADS:
processor = None
try:
processor = failedProcessor.FailedProcessor(dirName, nzbName)
process_result = processor.process()
@ -424,7 +428,8 @@ def process_failed(dirName, nzbName):
process_result = False
process_fail_message = ex(e)
returnStr += processor.log
if processor:
returnStr += processor.log
if sickbeard.DELETE_FAILED and process_result:
delete_dir(dirName)

View file

@ -212,37 +212,36 @@ class FailedQueueItem(generic_queue.QueueItem):
def execute(self):
generic_queue.QueueItem.execute(self)
for season in self.segment:
epObj = self.segment[season]
for season, episodes in self.segment.items():
for epObj in episodes:
(release, provider) = failed_history.findRelease(epObj)
if release:
logger.log(u"Marking release as bad: " + release)
failed_history.markFailed(epObj)
failed_history.logFailed(release)
history.logFailed(epObj, release, provider)
failed_history.revertEpisode(epObj)
(release, provider) = failed_history.findRelease(epObj)
if release:
logger.log(u"Marking release as bad: " + release)
failed_history.markFailed(epObj)
failed_history.logFailed(release)
history.logFailed(epObj, release, provider)
failed_history.revertEpisode(epObj)
logger.log(
"Beginning failed download search for [" + epObj.prettyName() + "]")
try:
searchResult = search.searchProviders(self.show, season, [epObj], True)
logger.log(
"Beginning failed download search for [" + epObj.prettyName() + "]")
try:
searchResult = search.searchProviders(self.show, season, [epObj], True)
# reset thread back to original name
threading.currentThread().name = self.thread_name
# reset thread back to original name
threading.currentThread().name = self.thread_name
if searchResult:
for result in searchResult:
# just use the first result for now
logger.log(u"Downloading " + result.name + " from " + result.provider.name)
search.snatchEpisode(result)
if searchResult:
for result in searchResult:
# just use the first result for now
logger.log(u"Downloading " + result.name + " from " + result.provider.name)
search.snatchEpisode(result)
# give the CPU a break
time.sleep(2)
# give the CPU a break
time.sleep(2)
else:
logger.log(u"No episodes found to retry for failed downloads return from providers!")
except Exception, e:
logger.log(traceback.format_exc(), logger.DEBUG)
else:
logger.log(u"No valid episode found to retry for [" + epObj.prettyName() + "]")
except Exception, e:
logger.log(traceback.format_exc(), logger.DEBUG)
self.finish()