mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
This fixes all failed download issues
This commit is contained in:
parent
a12085cbfc
commit
d616ca2298
2 changed files with 32 additions and 28 deletions
|
@ -393,6 +393,8 @@ def delete_dir(processPath):
|
||||||
|
|
||||||
|
|
||||||
def get_path_dir_files(dirName, nzbName, type):
|
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
|
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
|
#Get at first all the subdir in the dirName
|
||||||
for path, dirs, files in ek.ek(os.walk, dirName):
|
for path, dirs, files in ek.ek(os.walk, dirName):
|
||||||
|
@ -416,6 +418,8 @@ def process_failed(dirName, nzbName):
|
||||||
global returnStr
|
global returnStr
|
||||||
|
|
||||||
if sickbeard.USE_FAILED_DOWNLOADS:
|
if sickbeard.USE_FAILED_DOWNLOADS:
|
||||||
|
processor = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
processor = failedProcessor.FailedProcessor(dirName, nzbName)
|
processor = failedProcessor.FailedProcessor(dirName, nzbName)
|
||||||
process_result = processor.process()
|
process_result = processor.process()
|
||||||
|
@ -424,7 +428,8 @@ def process_failed(dirName, nzbName):
|
||||||
process_result = False
|
process_result = False
|
||||||
process_fail_message = ex(e)
|
process_fail_message = ex(e)
|
||||||
|
|
||||||
returnStr += processor.log
|
if processor:
|
||||||
|
returnStr += processor.log
|
||||||
|
|
||||||
if sickbeard.DELETE_FAILED and process_result:
|
if sickbeard.DELETE_FAILED and process_result:
|
||||||
delete_dir(dirName)
|
delete_dir(dirName)
|
||||||
|
|
|
@ -212,37 +212,36 @@ class FailedQueueItem(generic_queue.QueueItem):
|
||||||
def execute(self):
|
def execute(self):
|
||||||
generic_queue.QueueItem.execute(self)
|
generic_queue.QueueItem.execute(self)
|
||||||
|
|
||||||
for season in self.segment:
|
for season, episodes in self.segment.items():
|
||||||
epObj = self.segment[season]
|
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)
|
logger.log(
|
||||||
if release:
|
"Beginning failed download search for [" + epObj.prettyName() + "]")
|
||||||
logger.log(u"Marking release as bad: " + release)
|
try:
|
||||||
failed_history.markFailed(epObj)
|
searchResult = search.searchProviders(self.show, season, [epObj], True)
|
||||||
failed_history.logFailed(release)
|
|
||||||
history.logFailed(epObj, release, provider)
|
|
||||||
failed_history.revertEpisode(epObj)
|
|
||||||
|
|
||||||
logger.log(
|
# reset thread back to original name
|
||||||
"Beginning failed download search for [" + epObj.prettyName() + "]")
|
threading.currentThread().name = self.thread_name
|
||||||
try:
|
|
||||||
searchResult = search.searchProviders(self.show, season, [epObj], True)
|
|
||||||
|
|
||||||
# reset thread back to original name
|
if searchResult:
|
||||||
threading.currentThread().name = self.thread_name
|
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:
|
# give the CPU a break
|
||||||
for result in searchResult:
|
time.sleep(2)
|
||||||
# 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
|
else:
|
||||||
time.sleep(2)
|
logger.log(u"No valid episode found to retry for [" + epObj.prettyName() + "]")
|
||||||
|
except Exception, e:
|
||||||
else:
|
logger.log(traceback.format_exc(), logger.DEBUG)
|
||||||
logger.log(u"No episodes found to retry for failed downloads return from providers!")
|
|
||||||
except Exception, e:
|
|
||||||
logger.log(traceback.format_exc(), logger.DEBUG)
|
|
||||||
|
|
||||||
self.finish()
|
self.finish()
|
Loading…
Reference in a new issue