From f569d249d96479f9da73e0b37d3f543fa41eeadc Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 26 Nov 2017 18:19:05 +0100 Subject: [PATCH] Fix remote, fix --list --- src/be/nikiroo/fanfix/Main.java | 15 ++++++++++++++- .../fanfix/library/RemoteLibraryServer.java | 3 +-- 2 files changed, 15 insertions(+), 3 deletions(-) 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]; -- 2.27.0