From b56c9d60fe4ed9470881ebf6221acb0a52997291 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Fri, 10 Aug 2018 18:08:53 +0200 Subject: [PATCH] Try 3 --- .../nikiroo/fanfix/library/CacheLibrary.java | 2 +- .../nikiroo/fanfix/library/LocalLibrary.java | 18 +++++++++++++++--- .../fanfix/library/RemoteLibraryServer.java | 3 --- src/be/nikiroo/fanfix/supported/E621.java | 2 ++ 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/be/nikiroo/fanfix/library/CacheLibrary.java b/src/be/nikiroo/fanfix/library/CacheLibrary.java index ee2db3f..a906330 100644 --- a/src/be/nikiroo/fanfix/library/CacheLibrary.java +++ b/src/be/nikiroo/fanfix/library/CacheLibrary.java @@ -124,7 +124,7 @@ public class CacheLibrary extends BasicLibrary { @Override protected void updateInfo(MetaData meta) { - if (meta != null) { + if (meta != null && metas != null) { for (int i = 0; i < metas.size(); i++) { if (metas.get(i).getLuid().equals(meta.getLuid())) { metas.set(i, meta); diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 54ad1d6..e531072 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -86,7 +86,7 @@ public class LocalLibrary extends BasicLibrary { this.lastId = 0; this.stories = null; - this.sourceCovers = new HashMap(); + this.sourceCovers = null; baseDir.mkdirs(); } @@ -134,7 +134,7 @@ public class LocalLibrary extends BasicLibrary { @Override protected void deleteInfo(String luid) { stories = null; - sourceCovers = new HashMap(); + sourceCovers = null; } @Override @@ -199,6 +199,10 @@ public class LocalLibrary extends BasicLibrary { @Override public Image getSourceCover(String source) { + if (sourceCovers == null) { + getStories(null); + } + if (!sourceCovers.containsKey(source)) { sourceCovers.put(source, super.getSourceCover(source)); } @@ -208,6 +212,10 @@ public class LocalLibrary extends BasicLibrary { @Override public void setSourceCover(String source, String luid) { + if (sourceCovers == null) { + getStories(null); + } + sourceCovers.put(source, getCover(luid)); File cover = new File(getExpectedDir(source), ".cover"); try { @@ -273,7 +281,6 @@ public class LocalLibrary extends BasicLibrary { } super.imprt(other, luid, pg); - deleteInfo(); } @@ -425,6 +432,7 @@ public class LocalLibrary extends BasicLibrary { if (stories == null) { stories = new HashMap(); + sourceCovers = new HashMap(); lastId = 0; @@ -520,6 +528,10 @@ public class LocalLibrary extends BasicLibrary { * the cover image */ void setSourceCover(String source, Image coverImage) { + if (sourceCovers == null) { + getStories(null); + } + sourceCovers.put(source, coverImage); File cover = new File(getExpectedDir(source), ".cover"); try { diff --git a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java index 138246a..dae73e4 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java @@ -178,8 +178,6 @@ public class RemoteLibraryServer extends ServerObject { * @return the list of {@link Object}s */ static List breakStory(Story story) { - System.out.println("Story to break: "+story); - List list = new ArrayList(); story = story.clone(); @@ -220,7 +218,6 @@ public class RemoteLibraryServer extends ServerObject { } } - System.out.println("rebuilt story: "+story); return story; } diff --git a/src/be/nikiroo/fanfix/supported/E621.java b/src/be/nikiroo/fanfix/supported/E621.java index 407ec70..c57f8fd 100644 --- a/src/be/nikiroo/fanfix/supported/E621.java +++ b/src/be/nikiroo/fanfix/supported/E621.java @@ -58,6 +58,8 @@ class E621 extends BasicSupport_Deprecated { meta.setCover(getCover(source, reset(in))); meta.setFakeCover(true); + System.out.println("Meta from e621: "+meta); + return meta; } -- 2.27.0