IMP: Added ability to allow ComicRN script to be run on items snatched outside of Mylar

This commit is contained in:
evilhero 2016-12-13 11:15:32 -05:00
parent 9c6bb12dd1
commit d260cfe087
2 changed files with 32 additions and 3 deletions

View File

@ -896,10 +896,11 @@ class PostProcessor(object):
logger.fdebug(module + ' Trying to locate nzbfile again with nzbname of : ' + str(nzbname))
nzbiss = myDB.selectone("SELECT * from nzblog WHERE nzbname=? or altnzbname=?", [nzbname, nzbname]).fetchone()
if nzbiss is None:
logger.error(module + ' Unable to locate downloaded file to rename. PostProcessing aborted.')
self._log('Unable to locate downloaded file to rename. PostProcessing aborted.')
logger.error(module + ' Unable to locate downloaded file to rename within items I have snatched. Attempting to parse the filename directly and process.')
#set it up to run manual post-processing on self.nzb_folder
self._log('Unable to locate downloaded file to rename within items I have snatched. Attempting to parse the filename directly and process.')
self.valreturn.append({"self.log": self.log,
"mode": 'stop'})
"mode": 'outside'})
return self.queue.put(self.valreturn)
else:
self._log("I corrected and found the nzb as : " + str(nzbname))

View File

@ -681,6 +681,7 @@ class WebInterface(object):
failed = True
queue = Queue.Queue()
retry_outside = False
if not failed:
PostProcess = PostProcessor.PostProcessor(nzb_name, nzb_folder, queue=queue)
@ -703,6 +704,10 @@ class WebInterface(object):
elif chk[0]['mode'] == 'stop':
yield chk[0]['self.log']
break
elif chk[0]['mode'] == 'outside':
yield chk[0]['self.log']
retry_outside = True
break
else:
logger.error('mode is unsupported: ' + chk[0]['mode'])
yield chk[0]['self.log']
@ -730,6 +735,29 @@ class WebInterface(object):
yield failchk[0]['self.log']
else:
logger.warn('Failed Download Handling is not enabled. Leaving Failed Download as-is.')
if retry_outside:
PostProcess = PostProcessor.PostProcessor('Manual Run', nzb_folder, queue=queue)
thread_ = threading.Thread(target=PostProcess.Process, name="Post-Processing")
thread_.start()
thread_.join()
chk = queue.get()
while True:
if chk[0]['mode'] == 'fail':
yield chk[0]['self.log']
logger.info('Initiating Failed Download handling')
if chk[0]['annchk'] == 'no': mode = 'want'
else: mode = 'want_ann'
failed = True
break
elif chk[0]['mode'] == 'stop':
yield chk[0]['self.log']
break
else:
logger.error('mode is unsupported: ' + chk[0]['mode'])
yield chk[0]['self.log']
break
post_process.exposed = True
def pauseSeries(self, ComicID):