cover: allow custom author covers
[fanfix.git] / src / be / nikiroo / fanfix / library / RemoteLibraryServer.java
index aa5f3056a2536981850498c17fb5a6e560bd1f4f..d73943831144add2b16bd4edfeaf35cd9c43d94d 100644 (file)
@@ -41,9 +41,10 @@ import be.nikiroo.utils.serial.server.ServerObject;
  * the LUID</li>
  * <li>[md5] DELETE_STORY [luid]: delete the story of LUID luid</li>
  * <li>[md5] GET_COVER [luid]: return the cover of the story</li>
- * <li>[md5] GET_CUSTOM_SOURCE_COVER [source]: return the cover for this source</li>
- * <li>[md5] SET_SOURCE_COVER [source], [luid]: set the default cover for the
- * given source to the cover of the story denoted by luid</li>
+ * <li>[md5] GET_CUSTOM_COVER ["SOURCE"|"AUTHOR"] [source]: return the cover for
+ * this source/author</li>
+ * <li>[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</li>
  * <li>[md5] CHANGE_SOURCE [luid] [new source]: change the source of the story
  * of LUID luid</li>
  * <li>[md5] EXIT: stop the server</li>
@@ -180,11 +181,24 @@ 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 ("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().changeSTA((String) args[0], (String) args[1],