From 93f2f75cdc99c63a9adda93f49d17b40d33e084e Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sun, 16 Feb 2014 10:46:59 +1030 Subject: [PATCH] added Torrent label to userscript options. fixes #262 --- TorrentToMedia.py | 7 +++++-- autoProcessMedia.cfg.sample | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index bd3c30da..ecfe9c55 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -251,7 +251,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): if (inputCategory in user_script_categories and not "NONE" in user_script_categories) or ("ALL" in user_script_categories and not inputCategory in processCategories): Logger.info("MAIN: Processing user script %s.", user_script) - result = external_script(outputDestination,inputName) + result = external_script(outputDestination,inputName,inputCategory) elif status == int(0) or (inputCategory in hpCategory + mlCategory + gzCategory): # if movies linked/extracted or for other categories. Logger.debug("MAIN: Calling autoProcess script for successful download.") status = int(0) # hp, my, gz don't support failed. @@ -343,7 +343,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): Logger.debug("media/meta file found: %s", item) Logger.info("MAIN: All done.") -def external_script(outputDestination,torrentName): +def external_script(outputDestination,torrentName,torrentLabel): final_result = int(0) # start at 0. num_files = int(0) @@ -368,6 +368,9 @@ def external_script(outputDestination,torrentName): elif param == "TN": command.append(torrentName) continue + elif param == "TL": + command.append(torrentLabel) + continue elif param == "DN": if user_script_runOnce == 1: command.append(outputDestination) diff --git a/autoProcessMedia.cfg.sample b/autoProcessMedia.cfg.sample index 6f9245d2..6946c9ee 100644 --- a/autoProcessMedia.cfg.sample +++ b/autoProcessMedia.cfg.sample @@ -151,8 +151,8 @@ user_script_mediaExtensions = .mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg #Specify the path of the script user_script_path = /media/test/script/script.sh #Specify the argument(s) passed to script, comma separated in order. -#for example FP,FN,DN, TN for file path (absolute file name with path), file name, absolute directory name (with path), TorrentName. -#So the result is /media/test/script/script.sh FP FN DN TN. Add other arguments as needed eg -f, -r +#for example FP,FN,DN, TN, TL for file path (absolute file name with path), file name, absolute directory name (with path), Torrent Name, Torrent Label/Category. +#So the result is /media/test/script/script.sh FP FN DN TN TL. Add other arguments as needed eg -f, -r user_script_param = FN #Set user_script_runOnce = 0 to run for each file, or 1 to only run once (presumably on teh entire directory). user_script_runOnce = 0