remote: do not send the cover in the metas
authorNiki Roo <niki@nikiroo.be>
Sun, 3 Mar 2019 17:17:06 +0000 (18:17 +0100)
committerNiki Roo <niki@nikiroo.be>
Sun, 3 Mar 2019 17:17:06 +0000 (18:17 +0100)
src/be/nikiroo/fanfix/library/RemoteLibrary.java
src/be/nikiroo/fanfix/library/RemoteLibraryServer.java

index dc95f0d4ca761229e451ab714bb979155b771345..71b65bf97f0e0dc52e3815a7ca2b1a7f9aad09b5 100644 (file)
@@ -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 "*".
+        * <p>
+        * Will not get the covers.
         * 
         * @param luid
         *            the luid of the story or *
index 7d5a0ae10d988f1a79f52f7732dfb0411e5f057e..c0b05064c2ec4a7915ee2b26393766ac377c0047 100644 (file)
@@ -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<MetaData> metas = Instance.getLibrary().getMetas(pg);
+
+                               List<MetaData> metas = new ArrayList<MetaData>();
+                               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[] {});
                        }