X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FRemoteLibraryServer.java;h=661bf54d61b8100d0b00a964b9016f77945666c8;hb=a85e807750081c6e77a7916ca4e79506b5a98537;hp=566c70fa69a572043ea6749ae5361b05b6ac4b73;hpb=4f722df2645dc6202e87a98cad1df77a530ddca1;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java index 566c70f..661bf54 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java @@ -9,10 +9,32 @@ import be.nikiroo.utils.Version; import be.nikiroo.utils.serial.ConnectActionServer; import be.nikiroo.utils.serial.Server; +/** + * Create a new remote server that will listen for order on the given port. + *

+ * The available commands are: + *

+ * + * @author niki + */ public class RemoteLibraryServer extends Server { + /** + * Create a new remote server (will not be active until + * {@link RemoteLibraryServer#start()} is called). + * + * @param port + * the port to listen on + * + * @throws IOException + * in case of I/O error + */ public RemoteLibraryServer(int port) throws IOException { - super(Version.getCurrentVersion(), port, true); + super(port, true); } @Override @@ -32,16 +54,16 @@ public class RemoteLibraryServer extends Server { System.out.println(String.format("COMMAND: [%s], ARGS: [%s]", command, args)); - if (command != null) { - if (command.equals("GET_METADATA")) { - if (args != null && args.equals("*")) { - List metas = Instance.getLibrary().getMetas(null); - return metas.toArray(new MetaData[] {}); - } - } else if (command.equals("GET_STORY")) { - if (args != null) { - return Instance.getLibrary().getStory(args, null); - } + // TODO: progress (+send name + %age info back to client) + + if ("GET_METADATA".equals(command)) { + if (args != null && args.equals("*")) { + List metas = Instance.getLibrary().getMetas(null); + return metas.toArray(new MetaData[] {}); + } + } else if ("GET_STORY".equals(command)) { + if (args != null) { + return Instance.getLibrary().getStory(args, null); } }