From 4c68fd2fd923120dacf1d906ef9a04f1586052dc Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Sat, 15 Feb 2014 21:19:02 +1030 Subject: [PATCH] added TorrentName to user_script 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 024b9dbc..bd3c30da 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) + result = external_script(outputDestination,inputName) 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): +def external_script(outputDestination,torrentName): final_result = int(0) # start at 0. num_files = int(0) @@ -365,6 +365,9 @@ def external_script(outputDestination): elif param == "FP": command.append(filePath) continue + elif param == "TN": + command.append(torrentName) + continue elif param == "DN": if user_script_runOnce == 1: command.append(outputDestination) diff --git a/autoProcessMedia.cfg.sample b/autoProcessMedia.cfg.sample index c08a1357..6f9245d2 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 for file path (absolute file name with path), file name, absolute directory name (with path). -#So the result is /media/test/script/script.sh FP FN DN. Add other arguments as needed eg -f, -r +#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 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