X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FRemoteLibrary.java;h=29d2bcda594f353afc882436438d071686db2dc0;hp=acbd495d079b88047bfbc0e0e1769894b7375a1e;hb=085a2f9a3a811a910de7c3011eb6f5ef2ab18aa0;hpb=2249988a85d0daeb952b4d2df63b838c9385143c diff --git a/src/be/nikiroo/fanfix/library/RemoteLibrary.java b/src/be/nikiroo/fanfix/library/RemoteLibrary.java index acbd495..29d2bcd 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibrary.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibrary.java @@ -46,8 +46,8 @@ public class RemoteLibrary extends BasicLibrary { protected List getMetas(Progress pg) { // TODO: progress final List metas = new ArrayList(); - MetaData[] fromNetwork = this - . getRemoteObject("GET_METADATA *"); + MetaData[] fromNetwork = this. getRemoteObject( // + new Object[] { "GET_METADATA", "*" }); if (fromNetwork != null) { for (MetaData meta : fromNetwork) { @@ -60,12 +60,19 @@ public class RemoteLibrary extends BasicLibrary { @Override public BufferedImage getCover(final String luid) { - return this. getRemoteObject("GET_COVER " + luid); + return this. getRemoteObject( // + new Object[] { "GET_COVER", luid }); + } + + @Override + public BufferedImage getSourceCover(final String source) { + return this. getRemoteObject( // + new Object[] { "GET_SOURCE_COVER", source }); } @Override public synchronized Story getStory(final String luid, Progress pg) { - return this. getRemoteObject("GET_STORY " + luid); + return this. getRemoteObject(new Object[] { "GET_STORY", luid }); } @Override @@ -75,20 +82,24 @@ public class RemoteLibrary extends BasicLibrary { @Override public synchronized Story save(Story story, String luid, Progress pg) throws IOException { - throw new java.lang.InternalError( - "No write support allowed on remote Libraries"); + getRemoteObject(new Object[] { "SAVE_STORY", story, luid }); + + // because the meta changed: + clearCache(); + story.setMeta(getInfo(luid)); + + return story; } @Override public synchronized void delete(String luid) throws IOException { - throw new java.lang.InternalError( - "No write support allowed on remote Libraries"); + getRemoteObject(new Object[] { "DELETE_STORY", luid }); } @Override public void setSourceCover(String source, String luid) { - throw new java.lang.InternalError( - "No write support allowed on remote Libraries"); + this. getRemoteObject( // + new Object[] { "SET_SOURCE_COVER", source, luid }); } @Override @@ -125,7 +136,7 @@ public class RemoteLibrary extends BasicLibrary { * @return the object or NULL */ @SuppressWarnings("unchecked") - private T getRemoteObject(final String command) { + private T getRemoteObject(final Object[] command) { final Object[] result = new Object[1]; try { new ConnectActionClient(host, port, true) {