* move groovy default imports into ScriptShell.properties
This commit is contained in:
parent
ab62379e72
commit
dc6cc5e9c1
|
@ -1,4 +1,3 @@
|
|||
moduleName=filebot-groovy-all
|
||||
moduleVersion=4.1
|
||||
extensionClasses=net.sourceforge.filebot.cli.ScriptShellMethods,net.sourceforge.filebot.format.ExpressionFormatMethods,org.codehaus.groovy.jsr223.ScriptExtensions
|
||||
staticExtensionClasses=org.codehaus.groovy.jsr223.ScriptStaticExtensions
|
||||
moduleName=filebot-scripting-extension
|
||||
moduleVersion=4.0
|
||||
extensionClasses=net.sourceforge.filebot.cli.ScriptShellMethods,net.sourceforge.filebot.format.ExpressionFormatMethods
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.LinkedHashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.PropertyPermission;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.script.Bindings;
|
||||
import javax.script.ScriptContext;
|
||||
|
@ -56,18 +57,17 @@ public class ScriptShell {
|
|||
}
|
||||
|
||||
public ScriptEngine createScriptEngine() {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(ScriptShell.class.getName());
|
||||
|
||||
CompilerConfiguration config = new CompilerConfiguration();
|
||||
config.setScriptBaseClass("net.sourceforge.filebot.cli.ScriptShellBaseClass");
|
||||
config.setScriptBaseClass(bundle.getString("scriptBaseClass"));
|
||||
config.setRecompileGroovySource(false);
|
||||
config.setDebug(false);
|
||||
|
||||
// default imports
|
||||
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.addStaticStars("net.sourceforge.filebot.WebServices");
|
||||
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");
|
||||
imports.addStarImports(bundle.getString("starImport").split(", "));
|
||||
imports.addStaticStars(bundle.getString("starStaticImport").split(", "));
|
||||
config.addCompilationCustomizers(imports);
|
||||
|
||||
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)
|
||||
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>();
|
||||
|
||||
// try xattr metadata if enabled
|
||||
|
|
Loading…
Reference in New Issue