- sourceCovers.put(source, getCover(luid));
- File cover = new File(getExpectedDir(source), ".cover");
+ synchronized (lock) {
+ return authorCovers.get(author);
+ }
+ }
+
+ @Override
+ public void setSourceCover(String source, String luid) throws IOException {
+ setSourceCover(source, getCover(luid));
+ }
+
+ @Override
+ public void setAuthorCover(String author, String luid) throws IOException {
+ setAuthorCover(author, getCover(luid));
+ }
+
+ /**
+ * Set the source cover to the given story cover.
+ *
+ * @param source
+ * the source to change
+ * @param coverImage
+ * the cover image
+ */
+ void setSourceCover(String source, Image coverImage) {
+ File dir = getExpectedDir(source);
+ dir.mkdirs();
+ File cover = new File(dir, ".cover");
+ try {
+ Instance.getInstance().getCache().saveAsImage(coverImage, cover,
+ true);
+ synchronized (lock) {
+ if (sourceCovers != null) {
+ sourceCovers.put(source, coverImage);
+ }
+ }
+ } catch (IOException e) {
+ Instance.getInstance().getTraceHandler().error(e);
+ }
+ }
+
+ /**
+ * Set the author cover to the given story cover.
+ *
+ * @param author
+ * the author to change
+ * @param coverImage
+ * the cover image
+ */
+ void setAuthorCover(String author, Image coverImage) {
+ File cover = getAuthorCoverFile(author);
+ cover.getParentFile().mkdirs();