use of de.herrlock.manga.util.configuration.IndexerConfiguration in project Manga by herrlock.
the class Main method startCliDownloader.
private static void startCliDownloader(final CommandLine commandline) {
logger.traceEntry("Commandline: {}", commandline);
if (commandline.hasOption("hoster")) {
logger.info("Printing all Hoster:");
PrintAllHoster.printHoster(System.out);
} else {
Properties properties = //
Utils.newPropertiesBuilder().setProperty(Configuration.URL, //
commandline.getOptionValue("url")).setProperty(Configuration.PROXY, //
commandline.getOptionValue("proxy")).setProperty(Configuration.PATTERN, //
commandline.getOptionValue("pattern")).setProperty(Configuration.TIMEOUT, //
commandline.getOptionValue("timeout")).setProperty(Configuration.HEADLESS, //
String.valueOf(commandline.hasOption('i'))).build();
if (commandline.hasOption("list")) {
logger.info("Creating index");
IndexerConfiguration conf = IndexerConfiguration.create(properties);
logger.info(conf);
IndexerMain.writeIndex(conf);
} else {
logger.info("Starting Commandline-Downloader:");
DownloadConfiguration conf = DownloadConfiguration.create(properties);
logger.info(conf);
ConsoleDownloader downloader = new ConsoleDownloader(conf, conf.isHeadless());
DownloadProcessor.getInstance().addDownload(downloader);
}
}
}
Aggregations