mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
clean exit from userscript. Fixes #475
This commit is contained in:
parent
94110f3298
commit
50dc6c16f5
2 changed files with 7 additions and 7 deletions
|
@ -592,9 +592,9 @@ def process(inputDirectory, inputName=None, status=0, clientAgent='manual', down
|
|||
if clientAgent != 'manual':
|
||||
# update download status in our DB
|
||||
update_downloadInfoStatus(inputName, 1)
|
||||
|
||||
# cleanup our processing folders of any misc unwanted files and empty directories
|
||||
cleanDir(inputDirectory, sectionName, inputCategory)
|
||||
if not sectionName == 'UserScript':
|
||||
# cleanup our processing folders of any misc unwanted files and empty directories
|
||||
cleanDir(inputDirectory, sectionName, inputCategory)
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import os
|
|||
import nzbtomedia
|
||||
from subprocess import Popen
|
||||
from nzbtomedia.transcoder import transcoder
|
||||
from nzbtomedia.nzbToMediaUtil import import_subs, listMediaFiles
|
||||
from nzbtomedia.nzbToMediaUtil import import_subs, listMediaFiles, rmDir
|
||||
from nzbtomedia import logger
|
||||
|
||||
def external_script(outputDestination, torrentName, torrentLabel, settings):
|
||||
|
@ -18,7 +18,7 @@ def external_script(outputDestination, torrentName, torrentLabel, settings):
|
|||
except:
|
||||
nzbtomedia.USER_SCRIPT = None
|
||||
if nzbtomedia.USER_SCRIPT is None or nzbtomedia.USER_SCRIPT == "None": # do nothing and return success.
|
||||
return 0
|
||||
return [0, ""]
|
||||
try:
|
||||
nzbtomedia.USER_SCRIPT_PARAM = settings["user_script_param"]
|
||||
if isinstance(nzbtomedia.USER_SCRIPT_PARAM, str): nzbtomedia.USER_SCRIPT_PARAM = nzbtomedia.USER_SCRIPT_PARAM.split(',')
|
||||
|
@ -111,8 +111,8 @@ def external_script(outputDestination, torrentName, torrentLabel, settings):
|
|||
|
||||
if nzbtomedia.USER_SCRIPT_CLEAN == int(1) and num_files_new == 0 and final_result == 0:
|
||||
logger.info("All files have been processed. Cleaning outputDirectory %s" % (outputDestination))
|
||||
shutil.rmtree(outputDestination)
|
||||
rmDir(outputDestination)
|
||||
elif nzbtomedia.USER_SCRIPT_CLEAN == int(1) and num_files_new != 0:
|
||||
logger.info("%s files were processed, but %s still remain. outputDirectory will not be cleaned." % (
|
||||
num_files, num_files_new))
|
||||
return final_result
|
||||
return [final_result, '']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue