X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FWebLibrary.java;h=978dd9af51c05e5b56f93c2d61948e34fcbcc968;hp=9d1c773aae698457d920b5094668eebb74605202;hb=acbec0d232186ddf5431b696ee74a791ae5e828f;hpb=9742a9a5f5f054207b213af5c678866fa276f93c diff --git a/src/be/nikiroo/fanfix/library/WebLibrary.java b/src/be/nikiroo/fanfix/library/WebLibrary.java index 9d1c773..978dd9a 100644 --- a/src/be/nikiroo/fanfix/library/WebLibrary.java +++ b/src/be/nikiroo/fanfix/library/WebLibrary.java @@ -152,7 +152,12 @@ public class WebLibrary extends BasicLibrary { public Image getCover(String luid) throws IOException { InputStream in = post(WebLibraryUrls.getStoryUrlCover(luid)); try { - return new Image(in); + Image img = new Image(in); + if (img.getSize() > 0) { + return img; + } + + return null; } finally { in.close(); } @@ -162,7 +167,12 @@ public class WebLibrary extends BasicLibrary { public Image getCustomSourceCover(String source) throws IOException { InputStream in = post(WebLibraryUrls.getCoverUrlSource(source)); try { - return new Image(in); + Image img = new Image(in); + if (img.getSize() > 0) { + return img; + } + + return null; } finally { in.close(); } @@ -172,7 +182,12 @@ public class WebLibrary extends BasicLibrary { public Image getCustomAuthorCover(String author) throws IOException { InputStream in = post(WebLibraryUrls.getCoverUrlAuthor(author)); try { - return new Image(in); + Image img = new Image(in); + if (img.getSize() > 0) { + return img; + } + + return null; } finally { in.close(); } @@ -223,7 +238,10 @@ public class WebLibrary extends BasicLibrary { InputStream subin = post( WebLibraryUrls.getStoryUrl(luid, chapNum, number)); try { - para.setContentImage(new Image(subin)); + Image img = new Image(subin); + if (img.getSize() > 0) { + para.setContentImage(img); + } } finally { subin.close(); } @@ -291,6 +309,8 @@ public class WebLibrary extends BasicLibrary { try { subPg = JsonIO.toProgress( new JSONObject(IOUtils.readSmallStream(in))); + } catch (Exception e) { + subPg = null; } finally { in.close(); } @@ -333,6 +353,11 @@ public class WebLibrary extends BasicLibrary { } } + @Override + public synchronized void delete(String luid) throws IOException { + post(WebLibraryUrls.getDeleteUrlStory(luid), null).close(); + } + @Override protected void updateInfo(MetaData meta) { // Will be taken care of directly server side