X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fmain%2FCLI.java;h=176507434f952689b8c160bd236a49fb84186c93;hb=9587b6c270d65f010db0656ad322121d39c7d997;hp=0cf9cc4ad1838a60359a57cb30b33f796e9fccc1;hpb=fbfe4707a1e3e9f23c8e1904d1a0eb0c3fbf587f;p=jSite.git diff --git a/src/main/java/de/todesbaum/jsite/main/CLI.java b/src/main/java/de/todesbaum/jsite/main/CLI.java index 0cf9cc4..1765074 100644 --- a/src/main/java/de/todesbaum/jsite/main/CLI.java +++ b/src/main/java/de/todesbaum/jsite/main/CLI.java @@ -1,5 +1,5 @@ /* - * jSite - CLI.java - Copyright © 2006–2012 David Roden + * jSite - CLI.java - Copyright © 2006–2014 David Roden * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package de.todesbaum.jsite.main; import java.io.PrintWriter; +import java.util.List; import net.pterodactylus.util.io.StreamCopier.ProgressListener; import de.todesbaum.jsite.application.Freenet7Interface; @@ -50,7 +51,7 @@ public class CLI implements InsertListener { private Node[] nodes; /** The projects. */ - private Project[] projects; + private List projects; /** Whether the insert has finished. */ private boolean finished = false; @@ -103,6 +104,7 @@ public class CLI implements InsertListener { freenetInterface.setNode(node); projectInserter.setFreenetInterface(freenetInterface); + projectInserter.setPriority(configuration.getPriority()); Project currentProject = null; for (String argument : args) { @@ -220,6 +222,7 @@ public class CLI implements InsertListener { projectInserter.setProject(currentProject); projectInserter.start(new ProgressListener() { + @Override public void onProgress(long copied, long length) { System.out.print("Uploaded: " + copied + " / " + length + " bytes...\r"); } @@ -243,6 +246,7 @@ public class CLI implements InsertListener { /** * {@inheritDoc} */ + @Override public void projectInsertStarted(Project project) { outputWriter.println("Starting Insert of project \"" + project.getName() + "\"."); } @@ -250,6 +254,7 @@ public class CLI implements InsertListener { /** * {@inheritDoc} */ + @Override public void projectUploadFinished(Project project) { outputWriter.println("Project \"" + project.getName() + "\" has been uploaded, starting insert..."); } @@ -257,6 +262,7 @@ public class CLI implements InsertListener { /** * {@inheritDoc} */ + @Override public void projectURIGenerated(Project project, String uri) { outputWriter.println("URI: " + uri); } @@ -264,13 +270,18 @@ public class CLI implements InsertListener { /** * {@inheritDoc} */ + @Override public void projectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized) { + if (total == 0) { + return; + } outputWriter.println("Progress: " + succeeded + " done, " + failed + " failed, " + fatal + " fatal, " + total + " total" + (finalized ? " (finalized)" : "") + ", " + ((succeeded + failed + fatal) * 100 / total) + "%"); } /** * {@inheritDoc} */ + @Override public void projectInsertFinished(Project project, boolean success, Throwable cause) { outputWriter.println("Request URI: " + project.getFinalRequestURI(0)); finished = true;