From 4063f57e5434b4d7e8660e67c880cb07778804f2 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 29 Oct 2012 14:46:25 +0000 Subject: [PATCH] * easy way for accessing optional --def variables via _def.name --- source/net/sourceforge/filebot/cli/ScriptShell.java | 10 ++++++++++ website/scripts/utorrent-postprocess.groovy | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/cli/ScriptShell.java b/source/net/sourceforge/filebot/cli/ScriptShell.java index d03c4ee2..d47f73d9 100644 --- a/source/net/sourceforge/filebot/cli/ScriptShell.java +++ b/source/net/sourceforge/filebot/cli/ScriptShell.java @@ -17,6 +17,8 @@ import java.security.Permissions; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.security.ProtectionDomain; +import java.util.LinkedHashMap; +import java.util.Map; import java.util.Map.Entry; import java.util.PropertyPermission; @@ -132,6 +134,14 @@ class ScriptShell { bindings.put("_args", args); bindings.put("_shell", this); + Map defines = new LinkedHashMap(); + if (args.bindings != null) { + for (Entry it : args.bindings) { + defines.put(it.getKey(), it.getValue()); + } + } + bindings.put("_def", defines); + bindings.put("_types", MediaTypes.getDefault()); bindings.put("_log", CLILogger); diff --git a/website/scripts/utorrent-postprocess.groovy b/website/scripts/utorrent-postprocess.groovy index 9457c380..e0417c49 100644 --- a/website/scripts/utorrent-postprocess.groovy +++ b/website/scripts/utorrent-postprocess.groovy @@ -188,7 +188,7 @@ if (gmail && !getRenameLog().isEmpty()) { // send html mail def renameLog = getRenameLog() - def emailTitle = tryQuietly { ut_title } ?: input*.dir.unique() + def emailTitle = tryQuietly { ut_title } ?: input*.dir.name.unique() sendGmail( subject: "[FileBot] ${emailTitle}",