added option to disable unique directory in output. Fixes #425

This commit is contained in:
clinton-hall 2014-06-16 09:46:25 +09:30
commit 171eab48d1
2 changed files with 13 additions and 2 deletions

View file

@ -14,6 +14,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
status = 1 # 1 = failed | 0 = success status = 1 # 1 = failed | 0 = success
root = 0 root = 0
foundFile = 0 foundFile = 0
uniquePath = 1
if clientAgent != 'manual' and not nzbtomedia.DOWNLOADINFO: if clientAgent != 'manual' and not nzbtomedia.DOWNLOADINFO:
logger.debug('Adding TORRENT download info for directory %s to database' % (inputDirectory)) logger.debug('Adding TORRENT download info for directory %s to database' % (inputDirectory))
@ -107,12 +108,20 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
nzbtomedia.USER_SCRIPT_RUNONCE = int(section[usercat]["user_script_runOnce"]) nzbtomedia.USER_SCRIPT_RUNONCE = int(section[usercat]["user_script_runOnce"])
except: except:
nzbtomedia.USER_SCRIPT_RUNONCE = 1 nzbtomedia.USER_SCRIPT_RUNONCE = 1
try:
uniquePath = int(section[usercat]["unique_path"])
except:
uniquePath = 1
if clientAgent != 'manual': if clientAgent != 'manual':
nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName) nzbtomedia.pause_torrent(clientAgent, inputHash, inputID, inputName)
outputDestination = os.path.normpath( if uniquePath:
nzbtomedia.os.path.join(nzbtomedia.OUTPUTDIRECTORY, inputCategory, nzbtomedia.sanitizeName(inputName))) outputDestination = os.path.normpath(
nzbtomedia.os.path.join(nzbtomedia.OUTPUTDIRECTORY, inputCategory, nzbtomedia.sanitizeName(inputName)))
else:
outputDestination = os.path.normpath(
nzbtomedia.os.path.join(nzbtomedia.OUTPUTDIRECTORY, inputCategory))
logger.info("Output directory set to: %s" % (outputDestination)) logger.info("Output directory set to: %s" % (outputDestination))

View file

@ -281,6 +281,8 @@
#Clean after? Note that delay function is used to prevent possible mistake :) Delay is intended as seconds #Clean after? Note that delay function is used to prevent possible mistake :) Delay is intended as seconds
user_script_clean = 1 user_script_clean = 1
delay = 120 delay = 120
#Unique path (directory) created for every download. set 0 to disable.
unique_path = 1
##### Set to path where download client places completed downloads locally for this category ##### Set to path where download client places completed downloads locally for this category
watch_dir = watch_dir =