mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-17 23:05:03 -05:00
* allow GUI controls in scripting
This commit is contained in:
parent
52b302e3a4
commit
92fa4bb410
@ -5,6 +5,7 @@ package net.sourceforge.filebot.cli;
|
|||||||
import static net.sourceforge.filebot.cli.CLILogging.*;
|
import static net.sourceforge.filebot.cli.CLILogging.*;
|
||||||
import static net.sourceforge.tuned.FileUtilities.*;
|
import static net.sourceforge.tuned.FileUtilities.*;
|
||||||
|
|
||||||
|
import java.awt.AWTPermission;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FilePermission;
|
import java.io.FilePermission;
|
||||||
@ -153,6 +154,11 @@ class ScriptShell {
|
|||||||
permissions.add(new FilePermission(new File(System.getProperty("ehcache.disk.store.dir")).getAbsolutePath() + File.separator + "-", "write, delete"));
|
permissions.add(new FilePermission(new File(System.getProperty("ehcache.disk.store.dir")).getAbsolutePath() + File.separator + "-", "write, delete"));
|
||||||
permissions.add(new FilePermission(new File(System.getProperty("java.io.tmpdir")).getAbsolutePath() + File.separator + "-", "write, delete"));
|
permissions.add(new FilePermission(new File(System.getProperty("java.io.tmpdir")).getAbsolutePath() + File.separator + "-", "write, delete"));
|
||||||
|
|
||||||
|
// AWT / Swing permissions
|
||||||
|
permissions.add(new AWTPermission("accessEventQueue"));
|
||||||
|
permissions.add(new AWTPermission("toolkitModality"));
|
||||||
|
permissions.add(new AWTPermission("showWindowWithoutWarningBanner"));
|
||||||
|
|
||||||
// this is probably a security problem but nevermind
|
// this is probably a security problem but nevermind
|
||||||
permissions.add(new RuntimePermission("accessDeclaredMembers"));
|
permissions.add(new RuntimePermission("accessDeclaredMembers"));
|
||||||
permissions.add(new ReflectPermission("suppressAccessChecks"));
|
permissions.add(new ReflectPermission("suppressAccessChecks"));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// filebot -script "http://filebot.sf.net/scripts/artwork.tmdb.groovy" -trust-script /path/to/media/
|
// filebot -script "http://filebot.sf.net/scripts/artwork.tmdb.groovy" -trust-script /path/to/media/
|
||||||
|
|
||||||
// EXPERIMENTAL // HERE THERE BE DRAGONS
|
// EXPERIMENTAL // HERE THERE BE DRAGONS
|
||||||
if (net.sourceforge.filebot.Settings.applicationRevisionNumber < 812) throw new Exception("Application revision too old")
|
if (net.sourceforge.filebot.Settings.applicationRevisionNumber < 836) throw new Exception("Application revision too old")
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -65,8 +65,17 @@ args.eachMediaFolder { dir ->
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort by relevance
|
||||||
|
options = options.sortBySimilarity(query, { it.name })
|
||||||
|
|
||||||
// auto-select series
|
// auto-select series
|
||||||
def movie = options.sortBySimilarity(query, { it.name })[0]
|
def movie = options[0]
|
||||||
|
|
||||||
|
// require user input
|
||||||
|
if (options.size != 1 && !java.awt.GraphicsEnvironment.headless) {
|
||||||
|
movie = javax.swing.JOptionPane.showInputDialog(null, "Please select movie:", dir.path, 3, null, options.toArray(), movie);
|
||||||
|
if (movie == null) return null
|
||||||
|
}
|
||||||
|
|
||||||
println "$dir => $movie"
|
println "$dir => $movie"
|
||||||
fetchMovieArtworkAndNfo(dir, movie)
|
fetchMovieArtworkAndNfo(dir, movie)
|
||||||
|
Loading…
Reference in New Issue
Block a user