1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 09:18:51 -05:00

* easy way for accessing optional --def variables via _def.name

This commit is contained in:
Reinhard Pointner 2012-10-29 14:46:25 +00:00
parent 5bf2dc1a0f
commit 4063f57e54
2 changed files with 11 additions and 1 deletions

View File

@ -17,6 +17,8 @@ import java.security.Permissions;
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.PropertyPermission; import java.util.PropertyPermission;
@ -132,6 +134,14 @@ class ScriptShell {
bindings.put("_args", args); bindings.put("_args", args);
bindings.put("_shell", this); bindings.put("_shell", this);
Map<String, String> defines = new LinkedHashMap<String, String>();
if (args.bindings != null) {
for (Entry<String, String> it : args.bindings) {
defines.put(it.getKey(), it.getValue());
}
}
bindings.put("_def", defines);
bindings.put("_types", MediaTypes.getDefault()); bindings.put("_types", MediaTypes.getDefault());
bindings.put("_log", CLILogger); bindings.put("_log", CLILogger);

View File

@ -188,7 +188,7 @@ if (gmail && !getRenameLog().isEmpty()) {
// send html mail // send html mail
def renameLog = getRenameLog() def renameLog = getRenameLog()
def emailTitle = tryQuietly { ut_title } ?: input*.dir.unique() def emailTitle = tryQuietly { ut_title } ?: input*.dir.name.unique()
sendGmail( sendGmail(
subject: "[FileBot] ${emailTitle}", subject: "[FileBot] ${emailTitle}",