git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'subtree'
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
library
/
WebLibrary.java
diff --git
a/src/be/nikiroo/fanfix/library/WebLibrary.java
b/src/be/nikiroo/fanfix/library/WebLibrary.java
index 9d1c773aae698457d920b5094668eebb74605202..7566877cebd48343b47c1764ed31045ee8de78dd 100644
(file)
--- a/
src/be/nikiroo/fanfix/library/WebLibrary.java
+++ b/
src/be/nikiroo/fanfix/library/WebLibrary.java
@@
-126,6
+126,16
@@
public class WebLibrary extends BasicLibrary {
return new Version();
}
return new Version();
}
+ /**
+ * Stop the server.
+ *
+ * @throws IOException
+ * in case of I/O errors
+ */
+ public void stop() throws IOException {
+ post(WebLibraryUrls.EXIT_URL, null).close();
+ }
+
@Override
public Status getStatus() {
try {
@Override
public Status getStatus() {
try {
@@
-152,7
+162,12
@@
public class WebLibrary extends BasicLibrary {
public Image getCover(String luid) throws IOException {
InputStream in = post(WebLibraryUrls.getStoryUrlCover(luid));
try {
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();
}
} finally {
in.close();
}
@@
-162,7
+177,12
@@
public class WebLibrary extends BasicLibrary {
public Image getCustomSourceCover(String source) throws IOException {
InputStream in = post(WebLibraryUrls.getCoverUrlSource(source));
try {
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();
}
} finally {
in.close();
}
@@
-172,7
+192,12
@@
public class WebLibrary extends BasicLibrary {
public Image getCustomAuthorCover(String author) throws IOException {
InputStream in = post(WebLibraryUrls.getCoverUrlAuthor(author));
try {
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();
}
} finally {
in.close();
}
@@
-223,7
+248,10
@@
public class WebLibrary extends BasicLibrary {
InputStream subin = post(
WebLibraryUrls.getStoryUrl(luid, chapNum, number));
try {
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();
}
} finally {
subin.close();
}
@@
-291,6
+319,11
@@
public class WebLibrary extends BasicLibrary {
try {
subPg = JsonIO.toProgress(
new JSONObject(IOUtils.readSmallStream(in)));
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 {
in.close();
}
} finally {
in.close();
}
@@
-333,6
+366,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
@Override
protected void updateInfo(MetaData meta) {
// Will be taken care of directly server side