summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5e1bf96)
- item disappeared until restart when removing from cache (remote + gui)
- chapter numbers were not correct on MangaLel (inverted, but no real effect)
- more logging on client
*/
@Override
public String toString() {
*/
@Override
public String toString() {
- return String.format("%s: [%s]", "" + type, "" + content);
+ return String.format("%s: [%s]", "" + type, content == null ? "N/A"
+ : content);
public synchronized Story save(Story story, String luid, Progress pg)
throws IOException {
public synchronized Story save(Story story, String luid, Progress pg)
throws IOException {
+ Instance.getTraceHandler().trace(
+ this.getClass().getSimpleName() + ": saving story " + luid);
+
// Do not change the original metadata, but change the original story
MetaData meta = story.getMeta().clone();
story.setMeta(meta);
// Do not change the original metadata, but change the original story
MetaData meta = story.getMeta().clone();
story.setMeta(meta);
updateInfo(story.getMeta());
updateInfo(story.getMeta());
+ Instance.getTraceHandler().trace(
+ this.getClass().getSimpleName() + ": story saved (" + luid
+ + ")");
+
* in case of I/O error
*/
public synchronized void delete(String luid) throws IOException {
* in case of I/O error
*/
public synchronized void delete(String luid) throws IOException {
+ Instance.getTraceHandler().trace(
+ this.getClass().getSimpleName() + ": deleting story " + luid);
+
doDelete(luid);
deleteInfo(luid);
doDelete(luid);
deleteInfo(luid);
+
+ Instance.getTraceHandler().trace(
+ this.getClass().getSimpleName() + ": story deleted (" + luid
+ + ")");
public void clearFromCache(String luid) throws IOException {
if (isCached(luid)) {
cacheLib.delete(luid);
public void clearFromCache(String luid) throws IOException {
if (isCached(luid)) {
cacheLib.delete(luid);
@Override
public File getFile(String luid, Progress pg) {
@Override
public File getFile(String luid, Progress pg) {
- File[] files = getStories(pg).get(getInfo(luid));
+ Instance.getTraceHandler().trace(
+ this.getClass().getSimpleName() + ": get file for " + luid);
+
+ File file = null;
+ String mess = "no file found for ";
+
+ MetaData meta = getInfo(luid);
+ Instance.getTraceHandler().trace("(info is: " + meta + ")");
+
+ File[] files = getStories(pg).get(meta);
+ mess = "file retrieved for ";
+ file = files[1];
+ Instance.getTraceHandler().trace(
+ this.getClass().getSimpleName() + ": " + mess + luid);
+
+ return file;
* @param pg
* the optional {@link Progress}
*
* @param pg
* the optional {@link Progress}
*
- * @return the list of stories
+ * @return the list of stories (for each item, the first {@link File} is the info file, the
+ * second file is the target {@link File})
*/
private synchronized Map<MetaData, File[]> getStories(Progress pg) {
if (pg == null) {
*/
private synchronized Map<MetaData, File[]> getStories(Progress pg) {
if (pg == null) {
for (String starter : new String[] { "xdg-open", "open", "see",
"start", "run" }) {
try {
for (String starter : new String[] { "xdg-open", "open", "see",
"start", "run" }) {
try {
+ Instance.getTraceHandler().trace(
+ "starting external program");
Runtime.getRuntime().exec(
new String[] { starter, target.getAbsolutePath() });
ok = true;
Runtime.getRuntime().exec(
new String[] { starter, target.getAbsolutePath() });
ok = true;
throw new IOException("Cannot find a program to start the file");
}
} else {
throw new IOException("Cannot find a program to start the file");
}
} else {
+ Instance.getTraceHandler().trace("starting external program");
Runtime.getRuntime().exec(
new String[] { program, target.getAbsolutePath() });
}
Runtime.getRuntime().exec(
new String[] { program, target.getAbsolutePath() });
}
meta.setCover(images.get(imagesList.get(0)));
meta.setFakeCover(true);
}
meta.setCover(images.get(imagesList.get(0)));
meta.setFakeCover(true);
}
-
-System.out.println("Meta from Cbz support at end: "+meta);
} finally {
IOUtils.deltree(tmpDir);
if (zipIn != null) {
} finally {
IOUtils.deltree(tmpDir);
if (zipIn != null) {
protected List<Entry<String, URL>> getChapters(Progress pg) {
List<Entry<String, URL>> urls = new ArrayList<Entry<String, URL>>();
protected List<Entry<String, URL>> getChapters(Progress pg) {
List<Entry<String, URL>> urls = new ArrayList<Entry<String, URL>>();
Element doc = getSourceNode();
Element doc = getSourceNode();
- Element chapEls = doc.getElementsByClass("chapters").first();
- for (Element chapEl : chapEls.getElementsByTag("li")) {
+ Elements chapEls = doc.getElementsByClass("chapters").first()
+ .getElementsByTag("li");
+ for (Element chapEl : chapEls) {
Element titleEl = chapEl.getElementsByTag("h5").first();
String title = StringUtils.unhtml(titleEl.text()).trim();
Element titleEl = chapEl.getElementsByTag("h5").first();
String title = StringUtils.unhtml(titleEl.text()).trim();
- title = Integer.toString(i++); // because Atril does not support
- // strange file names
+
+ // because Atril does not support strange file names
+ title = Integer.toString(chapEls.size() - i);
Element linkEl = chapEl.getElementsByTag("h5").first()
.getElementsByTag("a").first();
Element linkEl = chapEl.getElementsByTag("h5").first()
.getElementsByTag("a").first();
} catch (MalformedURLException e) {
Instance.getTraceHandler().error(e);
}
} catch (MalformedURLException e) {
Instance.getTraceHandler().error(e);
}
}
Collections.reverse(urls);
}
Collections.reverse(urls);