mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-17 06:45:06 -05:00
* move groovy default imports into ScriptShell.properties
This commit is contained in:
parent
ab62379e72
commit
dc6cc5e9c1
@ -1,4 +1,3 @@
|
|||||||
moduleName=filebot-groovy-all
|
moduleName=filebot-scripting-extension
|
||||||
moduleVersion=4.1
|
moduleVersion=4.0
|
||||||
extensionClasses=net.sourceforge.filebot.cli.ScriptShellMethods,net.sourceforge.filebot.format.ExpressionFormatMethods,org.codehaus.groovy.jsr223.ScriptExtensions
|
extensionClasses=net.sourceforge.filebot.cli.ScriptShellMethods,net.sourceforge.filebot.format.ExpressionFormatMethods
|
||||||
staticExtensionClasses=org.codehaus.groovy.jsr223.ScriptStaticExtensions
|
|
||||||
|
@ -20,6 +20,7 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.PropertyPermission;
|
import java.util.PropertyPermission;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javax.script.Bindings;
|
import javax.script.Bindings;
|
||||||
import javax.script.ScriptContext;
|
import javax.script.ScriptContext;
|
||||||
@ -56,18 +57,17 @@ public class ScriptShell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ScriptEngine createScriptEngine() {
|
public ScriptEngine createScriptEngine() {
|
||||||
|
ResourceBundle bundle = ResourceBundle.getBundle(ScriptShell.class.getName());
|
||||||
|
|
||||||
CompilerConfiguration config = new CompilerConfiguration();
|
CompilerConfiguration config = new CompilerConfiguration();
|
||||||
config.setScriptBaseClass("net.sourceforge.filebot.cli.ScriptShellBaseClass");
|
config.setScriptBaseClass(bundle.getString("scriptBaseClass"));
|
||||||
config.setRecompileGroovySource(false);
|
config.setRecompileGroovySource(false);
|
||||||
config.setDebug(false);
|
config.setDebug(false);
|
||||||
|
|
||||||
// default imports
|
// default imports
|
||||||
ImportCustomizer imports = new ImportCustomizer();
|
ImportCustomizer imports = new ImportCustomizer();
|
||||||
imports.addStarImports("net.sourceforge.filebot", "net.sourceforge.filebot.util", "net.sourceforge.filebot.web", "net.sourceforge.filebot.media", "net.sourceforge.filebot.mediainfo", "net.sourceforge.filebot.hash");
|
imports.addStarImports(bundle.getString("starImport").split(", "));
|
||||||
imports.addStaticStars("net.sourceforge.filebot.WebServices");
|
imports.addStaticStars(bundle.getString("starStaticImport").split(", "));
|
||||||
imports.addStarImports("groovy.io", "groovy.xml", "groovy.json", "org.jsoup");
|
|
||||||
imports.addStarImports("java.nio.file", "java.nio.file.attribute", "java.util.regex");
|
|
||||||
imports.addStaticStars("java.nio.file.Files");
|
|
||||||
config.addCompilationCustomizers(imports);
|
config.addCompilationCustomizers(imports);
|
||||||
|
|
||||||
GroovyClassLoader classLoader = new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), config);
|
GroovyClassLoader classLoader = new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), config);
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
scriptBaseClass: net.sourceforge.filebot.cli.ScriptShellBaseClass
|
||||||
|
starImport: net.sourceforge.filebot, net.sourceforge.filebot.util, net.sourceforge.filebot.web, net.sourceforge.filebot.media, net.sourceforge.filebot.mediainfo, net.sourceforge.filebot.hash, net.sourceforge.filebot.similarity, groovy.io, groovy.xml, groovy.json, org.jsoup, java.nio.file, java.nio.file.attribute, java.util.regex
|
||||||
|
starStaticImport: net.sourceforge.filebot.WebServices, net.sourceforge.filebot.media.MediaDetection, java.nio.file.Files
|
@ -282,10 +282,10 @@ public class MediaDetection {
|
|||||||
if (useAnimeIndex)
|
if (useAnimeIndex)
|
||||||
index.addAll(getAnimeIndex());
|
index.addAll(getAnimeIndex());
|
||||||
|
|
||||||
return detectSeriesNames(files, locale, index);
|
return detectSeriesNames(files, index, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> detectSeriesNames(Collection<File> files, Locale locale, List<IndexEntry<SearchResult>> index) throws Exception {
|
public static List<String> detectSeriesNames(Collection<File> files, List<IndexEntry<SearchResult>> index, Locale locale) throws Exception {
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<String>();
|
||||||
|
|
||||||
// try xattr metadata if enabled
|
// try xattr metadata if enabled
|
||||||
|
Loading…
Reference in New Issue
Block a user