From 9f51d8ab092b891f407dc1bfe0e0fa1cef7ff944 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 3 Mar 2019 18:17:06 +0100 Subject: [PATCH] remote: do not send the cover in the metas --- .../nikiroo/fanfix/library/RemoteLibrary.java | 2 ++ .../fanfix/library/RemoteLibraryServer.java | 28 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/be/nikiroo/fanfix/library/RemoteLibrary.java b/src/be/nikiroo/fanfix/library/RemoteLibrary.java index dc95f0d4..71b65bf9 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibrary.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibrary.java @@ -446,6 +446,8 @@ public class RemoteLibrary extends BasicLibrary { /** * Return the meta of the given story or a list of all known metas if the * luid is "*". + *

+ * Will not get the covers. * * @param luid * the luid of the story or * diff --git a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java index 7d5a0ae1..c0b05064 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java @@ -103,12 +103,38 @@ public class RemoteLibraryServer extends ServerObject { return null; } + long start = new Date().getTime(); + Object rep = doRequest(action, command, args); + + getTraceHandler().trace( + String.format("[/%s]: %d ms", command, + (new Date().getTime() - start))); + + return rep; + } + + private Object doRequest(ConnectActionServerObject action, String command, + Object[] args) throws NoSuchFieldException, NoSuchMethodException, + ClassNotFoundException, IOException { if ("PING".equals(command)) { return "PONG"; } else if ("GET_METADATA".equals(command)) { if ("*".equals(args[0])) { Progress pg = createPgForwarder(action); - List metas = Instance.getLibrary().getMetas(pg); + + List metas = new ArrayList(); + for (MetaData meta : Instance.getLibrary().getMetas(pg)) { + MetaData light; + if (meta.getCover() == null) { + light = meta; + } else { + light = meta.clone(); + light.setCover(null); + } + + metas.add(light); + } + forcePgDoneSent(pg); return metas.toArray(new MetaData[] {}); } -- 2.27.0