X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FLocalLibrary.java;h=3d8aad12f904c7bc9123eccfb710507498a5f834;hb=3f9f9d63efef45f1b94bf37ece957cead9c29518;hp=275926cd93164788258381b094fcef594cde7bbf;hpb=fd25eddc49559d6b0edcc4e2ed5b9bf7869978da;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index 275926c..3d8aad1 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(); } @@ -127,9 +127,14 @@ public class LocalLibrary extends BasicLibrary { } @Override - protected synchronized void invalidateInfo(String luid) { + protected synchronized void updateInfo(MetaData meta) { + deleteInfo(); + } + + @Override + protected void deleteInfo(String luid) { stories = null; - sourceCovers = new HashMap(); + sourceCovers = null; } @Override @@ -189,11 +194,15 @@ public class LocalLibrary extends BasicLibrary { } } - invalidateInfo(); + deleteInfo(); } @Override public Image getSourceCover(String source) { + if (sourceCovers == null) { + getStories(null); + } + if (!sourceCovers.containsKey(source)) { sourceCovers.put(source, super.getSourceCover(source)); } @@ -203,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 { @@ -261,15 +274,13 @@ public class LocalLibrary extends BasicLibrary { pg.add(1); } - invalidateInfo(); + deleteInfo(); pg.done(); return; } } super.imprt(other, luid, pg); - - invalidateInfo(); } /** @@ -404,7 +415,7 @@ public class LocalLibrary extends BasicLibrary { * {@link LocalLibrary#baseDir}. *

* Will use a cached list when possible (see - * {@link BasicLibrary#invalidateInfo()}). + * {@link BasicLibrary#deleteInfo()}). * * @param pg * the optional {@link Progress} @@ -420,6 +431,7 @@ public class LocalLibrary extends BasicLibrary { if (stories == null) { stories = new HashMap(); + sourceCovers = new HashMap(); lastId = 0; @@ -515,6 +527,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 {