1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-10 19:35:15 -05:00
filebot/source/Main.java
Reinhard Pointner 0c674849d8 * refactored and simplified transfer api
* 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
2008-07-30 22:37:01 +00:00

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;
}
}