X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FRemoteLibraryServer.java;h=d73943831144add2b16bd4edfeaf35cd9c43d94d;hb=415c74543f4cdb92b32b495ac73c961f4f377387;hp=c0b05064c2ec4a7915ee2b26393766ac377c0047;hpb=9f51d8ab092b891f407dc1bfe0e0fa1cef7ff944;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java index c0b0506..d739438 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java @@ -41,9 +41,10 @@ import be.nikiroo.utils.serial.server.ServerObject; * the LUID *
  • [md5] DELETE_STORY [luid]: delete the story of LUID luid
  • *
  • [md5] GET_COVER [luid]: return the cover of the story
  • - *
  • [md5] GET_CUSTOM_SOURCE_COVER [source]: return the cover for this source
  • - *
  • [md5] SET_SOURCE_COVER [source], [luid]: set the default cover for the - * given source to the cover of the story denoted by luid
  • + *
  • [md5] GET_CUSTOM_COVER ["SOURCE"|"AUTHOR"] [source]: return the cover for + * this source/author
  • + *
  • [md5] SET_COVER ["SOURCE"|"AUTHOR"] [value] [luid]: set the default cover + * for the given source/author to the cover of the story denoted by luid
  • *
  • [md5] CHANGE_SOURCE [luid] [new source]: change the source of the story * of LUID luid
  • *
  • [md5] EXIT: stop the server
  • @@ -92,7 +93,7 @@ public class RemoteLibraryServer extends ServerObject { } } - String trace = "[" + command + "] "; + String trace = "[ " + command + "] "; for (Object arg : args) { trace += arg + " "; } @@ -107,7 +108,7 @@ public class RemoteLibraryServer extends ServerObject { Object rep = doRequest(action, command, args); getTraceHandler().trace( - String.format("[/%s]: %d ms", command, + String.format("[>%s]: %d ms", command, (new Date().getTime() - start))); return rep; @@ -123,6 +124,7 @@ public class RemoteLibraryServer extends ServerObject { Progress pg = createPgForwarder(action); List metas = new ArrayList(); + for (MetaData meta : Instance.getLibrary().getMetas(pg)) { MetaData light; if (meta.getCover() == null) { @@ -179,15 +181,28 @@ public class RemoteLibraryServer extends ServerObject { Instance.getLibrary().delete((String) args[0]); } else if ("GET_COVER".equals(command)) { return Instance.getLibrary().getCover((String) args[0]); - } else if ("GET_CUSTOM_SOURCE_COVER".equals(command)) { - return Instance.getLibrary().getCustomSourceCover((String) args[0]); - } else if ("SET_SOURCE_COVER".equals(command)) { - Instance.getLibrary().setSourceCover((String) args[0], - (String) args[1]); - } else if ("CHANGE_SOURCE".equals(command)) { + } else if ("GET_CUSTOM_COVER".equals(command)) { + if ("SOURCE".equals(args[0])) { + return Instance.getLibrary().getCustomSourceCover( + (String) args[1]); + } else if ("AUTHOR".equals(args[0])) { + return Instance.getLibrary().getCustomAuthorCover( + (String) args[1]); + } else { + return null; + } + } else if ("SET_COVER".equals(command)) { + if ("SOURCE".equals(args[0])) { + Instance.getLibrary().setSourceCover((String) args[1], + (String) args[2]); + } else if ("AUTHOR".equals(args[0])) { + Instance.getLibrary().setAuthorCover((String) args[1], + (String) args[2]); + } + } else if ("CHANGE_STA".equals(command)) { Progress pg = createPgForwarder(action); - Instance.getLibrary().changeSource((String) args[0], - (String) args[1], pg); + Instance.getLibrary().changeSTA((String) args[0], (String) args[1], + (String) args[2], (String) args[3], pg); forcePgDoneSent(pg); } else if ("EXIT".equals(command)) { stop(0, false); @@ -330,9 +345,10 @@ public class RemoteLibraryServer extends ServerObject { Instance.getTraceHandler().error(e); } - isDoneForwarded[0] = pg.isDone(); lastTime[0] = new Date().getTime(); } + + isDoneForwarded[0] = (pg.getProgress() >= pg.getMax()); } });