use of org.wikivoyage.listings.utils.FileUtilsException in project wikivoyage-listings by baturin.
the class Main method dailyUpdate.
private static void dailyUpdate(CommandLine cl, HashMap<String, OutputFormat> formats) throws IOException, FileUtilsException {
createWorkingDir();
createListingsDir();
createDumpsCacheDir();
DumpDownloader downloader = new DumpDownloader();
for (String language : Languages.getLanguageCodes()) {
log.info("Processing language " + language);
List<String> dumpDates = downloader.listDumps(language);
if (dumpDates.size() == 0) {
continue;
}
String latestDumpDate = dumpDates.get(0);
if (cl.latestCount != null) {
log.info("Processing the latest " + cl.latestCount + " dumps");
dumpDates = dumpDates.subList(0, cl.latestCount);
}
for (String dumpDate : dumpDates) {
log.info("Processing dump " + dumpDate);
try {
processDump(downloader, language, latestDumpDate, dumpDate, formats, !cl.doNotUseIntermediateFile);
} catch (Exception e) {
log.info("Failed to create dump " + dumpDate);
log.debug("Exception: ", e);
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
log.debug("Stack trace: " + sw.toString());
}
}
}
System.exit(0);
}
Aggregations