+ added webstart deployment
* added jnlp descriptors * automated build, code signing and pack200 compression * some webstart related code adjustments * added MediaInfo 0.7.19 native libs for various operating systems * updated jna * use .properties file for application settings (name, version, apikeys, ...)
78
build.xml
|
@ -109,6 +109,82 @@
|
|||
</target>
|
||||
|
||||
|
||||
<target name="webstart" depends="jar">
|
||||
<!-- create dirs -->
|
||||
<mkdir dir="${dir.dist}/webstart" />
|
||||
|
||||
<!-- copy jars -->
|
||||
<copy todir="${dir.dist}/webstart">
|
||||
<fileset dir="${dir.dist}" includes="filebot.jar" />
|
||||
<fileset dir="${dir.lib}" includes="*.jar" excludes="junit.jar, jna.jar" />
|
||||
</copy>
|
||||
|
||||
<!-- copy jna.jar without native libs -->
|
||||
<jar destfile="${dir.dist}/webstart/jna.jar">
|
||||
<zipfileset src="${dir.lib}/jna.jar" includes="**/*.class" />
|
||||
</jar>
|
||||
|
||||
<!-- create native lib jars -->
|
||||
<antcall target="webstart-nativelib">
|
||||
<param name="arch" value="win32-x86" />
|
||||
</antcall>
|
||||
<antcall target="webstart-nativelib">
|
||||
<param name="arch" value="win32-amd64" />
|
||||
</antcall>
|
||||
<antcall target="webstart-nativelib">
|
||||
<param name="arch" value="linux-i386" />
|
||||
</antcall>
|
||||
<antcall target="webstart-nativelib">
|
||||
<param name="arch" value="linux-amd64" />
|
||||
</antcall>
|
||||
<antcall target="webstart-nativelib">
|
||||
<param name="arch" value="darwin" />
|
||||
</antcall>
|
||||
|
||||
<!-- sign main jar and native lib jars -->
|
||||
<fileset id="signjar" dir="${dir.dist}/webstart" includes="filebot.jar, native/*.jar" />
|
||||
<apply executable="pack200">
|
||||
<arg line="--repack" />
|
||||
<srcfile />
|
||||
<fileset refid="signjar" />
|
||||
</apply>
|
||||
<signjar alias="filebot" keystore="filebot.keystore" storepass="secret">
|
||||
<fileset refid="signjar" />
|
||||
</signjar>
|
||||
|
||||
<!-- pack200 all jars -->
|
||||
<apply executable="pack200" dest="${dir.dist}/webstart">
|
||||
<targetfile />
|
||||
<srcfile />
|
||||
<fileset dir="${dir.dist}/webstart" includes="*.jar" />
|
||||
<mapper type="glob" from="*.jar" to="*.jar.pack.gz" />
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="webstart-nativelib">
|
||||
<!-- create temp dir -->
|
||||
<mkdir dir="${dir.dist}/webstart/native/${arch}" />
|
||||
|
||||
<!-- copy native libs to temp dir -->
|
||||
<copy todir="${dir.dist}/webstart/native/${arch}" flatten="true">
|
||||
<zipfileset src="${dir.lib}/jna.jar" includes="com/sun/jna/${arch}/*" />
|
||||
<fileset dir="${dir.lib}/native" includes="${arch}/*" />
|
||||
</copy>
|
||||
|
||||
<!-- create native lib jar -->
|
||||
<jar destfile="${dir.dist}/webstart/native/${arch}.jar" basedir="${dir.dist}/webstart/native/${arch}" />
|
||||
|
||||
<!-- delete temp dir -->
|
||||
<delete dir="${dir.dist}/webstart/native/${arch}" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="genkey">
|
||||
<genkey alias="filebot" keystore="filebot.keystore" storepass="secret" validity="3650" dname="CN=${user.name}" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build">
|
||||
<!-- create build dir -->
|
||||
<mkdir dir="${dir.build}" />
|
||||
|
@ -123,7 +199,7 @@
|
|||
<!-- copy resources -->
|
||||
<copy todir="${dir.build}">
|
||||
<fileset dir="${dir.source}">
|
||||
<exclude name="**/*.java"/>
|
||||
<exclude name="**/*.java" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
|
After Width: | Height: | Size: 854 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 184 B |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 702 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jnlp spec="1.0+" codebase="http://filebot.sourceforge.net/webstart/" href="filebot.jnlp">
|
||||
<information>
|
||||
<title>FileBot</title>
|
||||
<vendor>rednoah</vendor>
|
||||
<homepage href="http://sourceforge.net/projects/filebot/" />
|
||||
<description>A cross-platform tool for tv renaming, subtitle download and file verification</description>
|
||||
|
||||
<icon href="nosplash.png" kind="splash" />
|
||||
<icon href="icon48.png" width="48" height="48" />
|
||||
<icon href="icon32.png" width="32" height="32" />
|
||||
<icon href="icon16.png" width="16" height="16" />
|
||||
<icon href="shortcut.ico" kind="shortcut" />
|
||||
|
||||
<shortcut>
|
||||
<desktop />
|
||||
<menu />
|
||||
</shortcut>
|
||||
|
||||
<offline-allowed />
|
||||
</information>
|
||||
|
||||
<update check="timeout" policy="always" />
|
||||
|
||||
<security>
|
||||
<all-permissions />
|
||||
</security>
|
||||
|
||||
<resources>
|
||||
<property name="jnlp.packEnabled" value="true" />
|
||||
|
||||
<java version="1.6+" />
|
||||
<jar href="filebot.jar" main="true" />
|
||||
<extension name="lib" href="filebot.lib.jnlp" />
|
||||
</resources>
|
||||
|
||||
<resources os="Windows" arch="x86">
|
||||
<nativelib href="native/win32-x86.jar" />
|
||||
</resources>
|
||||
<resources os="Windows" arch="amd64">
|
||||
<nativelib href="native/win32-amd64.jar" />
|
||||
</resources>
|
||||
<resources os="Linux" arch="i386">
|
||||
<nativelib href="native/linux-i386.jar" />
|
||||
</resources>
|
||||
<resources os="Linux" arch="amd64">
|
||||
<nativelib href="native/linux-amd64.jar" />
|
||||
</resources>
|
||||
<resources os="Mac">
|
||||
<nativelib href="native/darwin.jar" />
|
||||
</resources>
|
||||
|
||||
<application-desc main-class="net.sourceforge.filebot.Main" />
|
||||
</jnlp>
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jnlp spec="1.0+" codebase="http://filebot.sourceforge.net/webstart/" href="filebot.lib.jnlp">
|
||||
<information>
|
||||
<title>Unsigned libs for FileBot</title>
|
||||
<vendor>rednoah</vendor>
|
||||
|
||||
<offline-allowed />
|
||||
</information>
|
||||
|
||||
<update check="timeout" policy="always" />
|
||||
|
||||
<resources>
|
||||
<property name="jnlp.packEnabled" value="true" />
|
||||
|
||||
<jar href="miglayout.jar" />
|
||||
<jar href="glazedlists.jar" />
|
||||
<jar href="nekohtml.jar" />
|
||||
<jar href="xercesImpl.jar" />
|
||||
<jar href="ehcache.jar" />
|
||||
<jar href="simmetrics.jar" />
|
||||
<jar href="args4j.jar" />
|
||||
<jar href="jna.jar" />
|
||||
<jar href="js-engine.jar" />
|
||||
<jar href="js.jar" />
|
||||
<jar href="junrar-custom.jar" />
|
||||
<jar href="sublight-ws.jar" />
|
||||
<jar href="xmlrpc-client.jar" />
|
||||
<jar href="commons-logging.jar" />
|
||||
</resources>
|
||||
|
||||
<component-desc />
|
||||
</jnlp>
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jnlp spec="1.0+" codebase="http://filebot.sourceforge.net/webstart/" href="filebot.sfv.jnlp">
|
||||
<information>
|
||||
<title>Simple File Verification</title>
|
||||
<vendor>rednoah</vendor>
|
||||
<homepage href="http://sourceforge.net/projects/filebot/" />
|
||||
|
||||
<icon href="nosplash.png" kind="splash" />
|
||||
<icon href="sfv48.png" width="48" height="48" />
|
||||
<icon href="sfv32.png" width="32" height="32" />
|
||||
<icon href="sfv16.png" width="16" height="16" />
|
||||
<icon href="sfv.ico" kind="shortcut" />
|
||||
|
||||
<association extensions="sfv" mime-type="text/x-extension-sfv">
|
||||
<description>sfv file</description>
|
||||
<icon href="sfv.ico" />
|
||||
</association>
|
||||
<association extensions="md5" mime-type="text/x-extension-md5">
|
||||
<description>md5sum file</description>
|
||||
<icon href="sfv.ico" />
|
||||
</association>
|
||||
<association extensions="sha" mime-type="text/x-extension-sha">
|
||||
<description>sha1sum file</description>
|
||||
<icon href="sfv.ico" />
|
||||
</association>
|
||||
|
||||
<offline-allowed />
|
||||
</information>
|
||||
|
||||
<update check="background" policy="always" />
|
||||
|
||||
<security>
|
||||
<all-permissions />
|
||||
</security>
|
||||
|
||||
<resources>
|
||||
<property name="jnlp.packEnabled" value="true" />
|
||||
|
||||
<java version="1.6+" />
|
||||
<jar href="filebot.jar" main="true" />
|
||||
<extension name="lib" href="filebot.lib.jnlp" />
|
||||
</resources>
|
||||
|
||||
<application-desc main-class="net.sourceforge.filebot.Main">
|
||||
<argument>--sfv</argument>
|
||||
</application-desc>
|
||||
</jnlp>
|
BIN
lib/jna.jar
|
@ -5,29 +5,34 @@ package net.sourceforge.filebot;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.sourceforge.filebot.ui.transfer.FileTransferable;
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import net.sourceforge.filebot.ui.transfer.FileTransferable;
|
||||
import net.sourceforge.tuned.FileUtilities;
|
||||
|
||||
|
||||
public class ArgumentBean {
|
||||
|
||||
@Option(name = "-help", usage = "Print this help message")
|
||||
private boolean help = false;
|
||||
|
||||
@Option(name = "-clear", usage = "Clear history and settings")
|
||||
@Option(name = "-clear", usage = "Clear application settings")
|
||||
private boolean clear = false;
|
||||
|
||||
@Option(name = "--sfv", usage = "Open file in 'SFV' panel", metaVar = "<file>")
|
||||
private boolean sfv;
|
||||
@Option(name = "-open", usage = "Open file", metaVar = "<file>")
|
||||
private boolean open = false;
|
||||
|
||||
@Option(name = "--sfv", usage = "Open SFV panel", metaVar = "<file>")
|
||||
private boolean sfv = false;
|
||||
|
||||
@Argument
|
||||
private List<File> arguments;
|
||||
private List<File> arguments = new LinkedList<File>();
|
||||
|
||||
|
||||
public boolean help() {
|
||||
|
@ -40,8 +45,13 @@ public class ArgumentBean {
|
|||
}
|
||||
|
||||
|
||||
public boolean open() {
|
||||
return open;
|
||||
}
|
||||
|
||||
|
||||
public boolean sfv() {
|
||||
return sfv;
|
||||
return sfv || (open && FileUtilities.containsOnly(arguments, MediaTypes.getFilter("verification")));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,10 +18,8 @@ import javax.swing.JFrame;
|
|||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import net.sourceforge.filebot.format.ExpressionFormat;
|
||||
import net.sourceforge.filebot.ui.MainFrame;
|
||||
import net.sourceforge.filebot.ui.NotificationLoggingHandler;
|
||||
|
@ -35,7 +33,11 @@ public class Main {
|
|||
* @param args
|
||||
*/
|
||||
public static void main(String... args) throws Exception {
|
||||
// initialize this stuff before anything else
|
||||
initializeLogging();
|
||||
initializeSecurityManager();
|
||||
|
||||
// parse arguments
|
||||
final ArgumentBean argumentBean = initializeArgumentBean(args);
|
||||
|
||||
if (argumentBean.help()) {
|
||||
|
@ -50,16 +52,11 @@ public class Main {
|
|||
Settings.userRoot().clear();
|
||||
}
|
||||
|
||||
initializeLogging();
|
||||
initializeSettings();
|
||||
initializeCache();
|
||||
initializeSecurityManager();
|
||||
|
||||
try {
|
||||
// use native laf an all platforms
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.toString(), e);
|
||||
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
@ -69,7 +66,7 @@ public class Main {
|
|||
JFrame frame;
|
||||
|
||||
if (argumentBean.sfv()) {
|
||||
// sfv frame
|
||||
// single panel frame
|
||||
frame = new SinglePanelFrame(new SfvPanelBuilder()).publish(argumentBean.transferable());
|
||||
} else {
|
||||
// default frame
|
||||
|
@ -103,30 +100,6 @@ public class Main {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Preset the default thetvdb.apikey.
|
||||
*/
|
||||
private static void initializeSettings() {
|
||||
Settings.userRoot().putDefault("thetvdb.apikey", "58B4AA94C59AD656");
|
||||
Settings.userRoot().putDefault("sublight.apikey", "afa9ecb2-a3ee-42b1-9225-000b4038bc85");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shutdown {@link CacheManager} in case there are any persistent caches that need to be stored.
|
||||
*/
|
||||
private static void initializeCache() {
|
||||
// shutdown CacheManager
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
CacheManager.getInstance().shutdown();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize default SecurityManager and grant all permissions via security policy.
|
||||
* Initialization is required in order to run {@link ExpressionFormat} in a secure sandbox.
|
||||
|
@ -164,10 +137,15 @@ public class Main {
|
|||
/**
|
||||
* Parse command line arguments.
|
||||
*/
|
||||
private static ArgumentBean initializeArgumentBean(String... args) throws CmdLineException {
|
||||
private static ArgumentBean initializeArgumentBean(String... args) {
|
||||
ArgumentBean argumentBean = new ArgumentBean();
|
||||
|
||||
new CmdLineParser(argumentBean).parseArgument(args);
|
||||
try {
|
||||
CmdLineParser parser = new CmdLineParser(argumentBean);
|
||||
parser.parseArgument(args);
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
|
||||
return argumentBean;
|
||||
}
|
||||
|
@ -179,7 +157,8 @@ public class Main {
|
|||
private static void printUsage(ArgumentBean argumentBean) {
|
||||
System.out.println("Options:");
|
||||
|
||||
new CmdLineParser(argumentBean).printUsage(System.out);
|
||||
CmdLineParser parser = new CmdLineParser(argumentBean);
|
||||
parser.printUsage(System.out);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
package net.sourceforge.filebot;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.prefs.BackingStoreException;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
|
@ -16,15 +19,39 @@ import net.sourceforge.tuned.PreferencesMap.StringAdapter;
|
|||
public final class Settings {
|
||||
|
||||
public static String getApplicationName() {
|
||||
return "FileBot";
|
||||
return getApplicationProperty("application.name");
|
||||
};
|
||||
|
||||
|
||||
public static String getApplicationVersion() {
|
||||
return "1.9";
|
||||
return getApplicationProperty("application.version");
|
||||
};
|
||||
|
||||
|
||||
public static String getApplicationProperty(String key) {
|
||||
return ResourceBundle.getBundle(Settings.class.getName(), Locale.ROOT).getString(key);
|
||||
}
|
||||
|
||||
|
||||
public static File getApplicationFolder() {
|
||||
// special handling for web start
|
||||
if (System.getProperty("javawebstart.version") != null) {
|
||||
// can't use working directory for web start applications
|
||||
File folder = new File(System.getProperty("user.home"), ".filebot");
|
||||
|
||||
// create folder if necessary
|
||||
if (!folder.exists()) {
|
||||
folder.mkdir();
|
||||
}
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
// use working directory
|
||||
return new File(System.getProperty("user.dir"));
|
||||
}
|
||||
|
||||
|
||||
private static final Settings userRoot = new Settings(Preferences.userNodeForPackage(Settings.class));
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# application settings
|
||||
application.name: FileBot
|
||||
application.version: 0.0
|
||||
|
||||
thetvdb.apikey: 58B4AA94C59AD656
|
||||
sublight.apikey: afa9ecb2-a3ee-42b1-9225-000b4038bc85
|
|
@ -9,13 +9,29 @@ import java.util.EnumMap;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sun.jna.NativeLibrary;
|
||||
import com.sun.jna.Platform;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.WString;
|
||||
|
||||
|
||||
public class MediaInfo implements Closeable {
|
||||
|
||||
static {
|
||||
// libmediainfo for linux depends on libzen
|
||||
if (Platform.isLinux()) {
|
||||
try {
|
||||
// We need to load dependencies first, because we know where our native libs are (e.g. Java Web Start Cache).
|
||||
// If we do not, the system will look for dependencies, but only in the library path.
|
||||
NativeLibrary.getInstance("zen");
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(MediaInfo.class.getName()).warning("Failed to preload libzen");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Pointer handle;
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package net.sourceforge.filebot.ui.panel.episodelist;
|
||||
|
||||
|
||||
import static net.sourceforge.filebot.Settings.*;
|
||||
import static net.sourceforge.filebot.ui.panel.episodelist.SeasonSpinnerModel.*;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
|
@ -74,7 +75,7 @@ public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, E
|
|||
new AnidbClient(),
|
||||
new TVDotComClient(),
|
||||
new IMDbClient(),
|
||||
new TheTVDBClient(Settings.userRoot().get("thetvdb.apikey"))
|
||||
new TheTVDBClient(getApplicationProperty("thetvdb.apikey"))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -100,6 +101,7 @@ public class EpisodeListPanel extends AbstractSearchPanel<EpisodeListProvider, E
|
|||
return new EpisodeListRequestProcessor(new EpisodeListRequest(provider, text, season));
|
||||
};
|
||||
|
||||
|
||||
private final PropertyChangeListener selectButtonListener = new PropertyChangeListener() {
|
||||
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package net.sourceforge.filebot.ui.panel.rename;
|
||||
|
||||
|
||||
import static net.sourceforge.filebot.Settings.*;
|
||||
import static net.sourceforge.filebot.ui.panel.rename.History.*;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -25,7 +26,7 @@ final class HistorySpooler {
|
|||
}
|
||||
|
||||
|
||||
private final File file = new File("history.xml");
|
||||
private final File file = new File(getApplicationFolder(), "history.xml");
|
||||
|
||||
private final History sessionHistory = new History();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
package net.sourceforge.filebot.ui.panel.rename;
|
||||
|
||||
|
||||
import static net.sourceforge.filebot.Settings.*;
|
||||
import static net.sourceforge.tuned.ui.LoadingOverlayPane.*;
|
||||
import static net.sourceforge.tuned.ui.TunedUtilities.*;
|
||||
|
||||
|
@ -143,7 +144,7 @@ public class RenamePanel extends JComponent {
|
|||
actionPopup.add(new AutoFetchEpisodeListAction(new AnidbClient()));
|
||||
actionPopup.add(new AutoFetchEpisodeListAction(new TVDotComClient()));
|
||||
actionPopup.add(new AutoFetchEpisodeListAction(new IMDbClient()));
|
||||
actionPopup.add(new AutoFetchEpisodeListAction(new TheTVDBClient(Settings.userRoot().get("thetvdb.apikey"))));
|
||||
actionPopup.add(new AutoFetchEpisodeListAction(new TheTVDBClient(getApplicationProperty("thetvdb.apikey"))));
|
||||
|
||||
actionPopup.addSeparator();
|
||||
actionPopup.addDescription(new JLabel("Options:"));
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, Subtitl
|
|||
return new SubtitleProvider[] {
|
||||
new OpenSubtitlesClient(String.format("%s %s", getApplicationName(), getApplicationVersion())),
|
||||
new SubsceneSubtitleClient(),
|
||||
new SublightSubtitleClient(getApplicationName(), Settings.userRoot().get("sublight.apikey")),
|
||||
new SublightSubtitleClient(getApplicationName(), getApplicationProperty("sublight.apikey")),
|
||||
new SubtitleSourceClient()
|
||||
};
|
||||
}
|
||||
|
|