use of de.herrlock.manga.downloader.MDownloader in project Manga by herrlock.
the class JDExport method execute.
public static void execute(final Properties p) {
logger.traceEntry();
String jdhome = p.getProperty(Configuration.JDFW);
if (jdhome == null || jdhome.trim().isEmpty()) {
throw new InitializeException("\"" + Configuration.JDFW + "\" must be set");
}
JDConfiguration conf = JDConfiguration.create(p);
MDownloader dlImpl = new JDExport(conf);
DownloadProcessor.getInstance().addDownload(dlImpl);
}
use of de.herrlock.manga.downloader.MDownloader in project Manga by herrlock.
the class MDObject method handle.
@Override
public void handle(final String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException {
logger.traceEntry();
JsonArrayBuilder arrayBuilder = Json.createArrayBuilder();
for (Entry<UUID, MDObject> entry : this.dlContext.entrySet()) {
UUID key = entry.getKey();
MDObject value = entry.getValue();
MDownloader mdownloader = value.getMdownloader();
arrayBuilder.add(//
Json.createObjectBuilder().add("uuid", //
key.toString()).add("url", //
value.getUrl()).add("started", //
mdownloader.getStarted()).add("progress", //
mdownloader.getProgress()).add("maxProgress", mdownloader.getMaxProgress()));
}
Json.createWriter(response.getOutputStream()).write(arrayBuilder.build());
response.setContentType(MediaType.JSON_UTF_8.toString());
response.setStatus(HttpServletResponse.SC_OK);
baseRequest.setHandled(true);
}
Aggregations