mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-17 06:45:06 -05:00
0c674849d8
* use more GlazedLists stuff (EventList, AutoCompleteSupport) and remove obsolete classes (SimpleListModel, TextCompletion) * don't use SearchResultCache in EpisodeListClient (was only done for better ui interactions) * removed caching from ResourceManager * some improvements based on FindBugs warnings * use args4j for improved argument parsing * updated ant build script * more general MessageBus/Handler (use Object as message type instead of string) * ChecksumComputationService is not a singleton anymore * TemporaryFolder is always recreated if it is deleted by the user, or another instance shutting down * Notifications flicker less when one window is removed and the others are layouted * lots of other refactoring
71 lines
1.6 KiB
Java
71 lines
1.6 KiB
Java
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
|
|
import javax.swing.SwingUtilities;
|
|
import javax.swing.UIManager;
|
|
|
|
import net.sourceforge.filebot.ArgumentBean;
|
|
import net.sourceforge.filebot.Settings;
|
|
import net.sourceforge.filebot.ui.FileBotWindow;
|
|
|
|
import org.kohsuke.args4j.CmdLineException;
|
|
import org.kohsuke.args4j.CmdLineParser;
|
|
|
|
|
|
public class Main {
|
|
|
|
/**
|
|
* @param args
|
|
*/
|
|
public static void main(String... args) {
|
|
|
|
final ArgumentBean argumentBean = parseArguments(args);
|
|
|
|
if (argumentBean.isClear())
|
|
Settings.getSettings().clear();
|
|
|
|
try {
|
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
|
} catch (Exception e) {
|
|
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, e.toString(), e);
|
|
}
|
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
|
@Override
|
|
public void run() {
|
|
FileBotWindow window = new FileBotWindow();
|
|
|
|
// publish messages from arguments to the newly created components
|
|
argumentBean.publishMessages();
|
|
|
|
// start
|
|
window.setVisible(true);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
private static ArgumentBean parseArguments(String... args) {
|
|
|
|
ArgumentBean argumentBean = new ArgumentBean();
|
|
CmdLineParser argumentParser = new CmdLineParser(argumentBean);
|
|
|
|
try {
|
|
argumentParser.parseArgument(args);
|
|
} catch (CmdLineException e) {
|
|
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.WARNING, e.getMessage());
|
|
}
|
|
|
|
if (argumentBean.isHelp()) {
|
|
System.out.println("Options:");
|
|
argumentParser.printUsage(System.out);
|
|
|
|
// just print help message and exit afterwards
|
|
System.exit(0);
|
|
}
|
|
|
|
return argumentBean;
|
|
}
|
|
}
|