Search in sources :

Example 1 with IndexerConfiguration

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);
        }
    }
}
Also used : IndexerConfiguration(de.herrlock.manga.util.configuration.IndexerConfiguration) ConsoleDownloader(de.herrlock.manga.downloader.ConsoleDownloader) Properties(java.util.Properties) DownloadConfiguration(de.herrlock.manga.util.configuration.DownloadConfiguration)

Aggregations

ConsoleDownloader (de.herrlock.manga.downloader.ConsoleDownloader)1 DownloadConfiguration (de.herrlock.manga.util.configuration.DownloadConfiguration)1 IndexerConfiguration (de.herrlock.manga.util.configuration.IndexerConfiguration)1 Properties (java.util.Properties)1