From: Niki Roo Date: Sun, 26 Nov 2017 17:19:05 +0000 (+0100) Subject: Fix remote, fix --list X-Git-Tag: fanfix-1.6.3~30 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=f569d249d96479f9da73e0b37d3f543fa41eeadc;p=fanfix.git Fix remote, fix --list --- diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index a133de7..813a9b4 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -4,9 +4,11 @@ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.List; import be.nikiroo.fanfix.bundles.StringId; import be.nikiroo.fanfix.data.Chapter; +import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix.library.BasicLibrary; import be.nikiroo.fanfix.library.CacheLibrary; @@ -439,7 +441,18 @@ public class Main { * @return the exit return code (0 = success) */ private static int list(String source) { - BasicReader.getReader().browse(source); + List stories; + stories = BasicReader.getReader().getLibrary().getListBySource(source); + + for (MetaData story : stories) { + String author = ""; + if (story.getAuthor() != null && !story.getAuthor().isEmpty()) { + author = " (" + story.getAuthor() + ")"; + } + + System.out.println(story.getLuid() + ": " + story.getTitle() + + author); + } return 0; } diff --git a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java index 5bbe4cd..d2d9a6e 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java @@ -55,7 +55,6 @@ public class RemoteLibraryServer extends Server { @Override protected Object onRequest(ConnectActionServer action, Version clientVersion, Object data) throws Exception { - String key = ""; String command = ""; Object[] args = new Object[0]; @@ -64,7 +63,7 @@ public class RemoteLibraryServer extends Server { if (dataArray.length >= 2) { args = new Object[dataArray.length - 2]; for (int i = 2; i < dataArray.length; i++) { - args[i] = dataArray[i]; + args[i - 2] = dataArray[i]; } key = "" + dataArray[0];