X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FWebLibrary.java;h=0f2510dd544218279d8ddcaa1beae3ad097d631c;hb=33c5ceb66e2288d7d752407f2c156473b04d94d9;hp=978dd9af51c05e5b56f93c2d61948e34fcbcc968;hpb=67efdbf7aa0e96e2207c40a8061a9f29c20fff65;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/WebLibrary.java b/src/be/nikiroo/fanfix/library/WebLibrary.java index 978dd9a..0f2510d 100644 --- a/src/be/nikiroo/fanfix/library/WebLibrary.java +++ b/src/be/nikiroo/fanfix/library/WebLibrary.java @@ -126,6 +126,26 @@ public class WebLibrary extends BasicLibrary { return new Version(); } + /** + * Stop the server. + * + * @throws IOException + * in case of I/O errors + */ + public void stop() throws IOException { + try { + post(WebLibraryUrls.EXIT_URL, null).close(); + } catch (Exception e) { + try { + Thread.sleep(200); + } catch (InterruptedException e1) { + } + if (getStatus() != Status.UNAVAILABLE) { + throw new IOException("Cannot exit the library", e); + } + } + } + @Override public Status getStatus() { try { @@ -309,6 +329,9 @@ public class WebLibrary extends BasicLibrary { try { subPg = JsonIO.toProgress( new JSONObject(IOUtils.readSmallStream(in))); + pg.setName(subPg.getName()); + pg.setMinMax(subPg.getMin(), subPg.getMax()); + pg.setProgress(subPg.getProgress()); } catch (Exception e) { subPg = null; } finally {