- public Image getSourceCover(String source) {
- if (!sourceCovers.containsKey(source)) {
- sourceCovers.put(source, super.getSourceCover(source));
+ public synchronized Image getCustomSourceCover(String source) {
+ if (sourceCovers == null) {
+ sourceCovers = new HashMap<String, Image>();
+ }
+
+ Image img = sourceCovers.get(source);
+ if (img != null) {
+ return img;
+ }
+
+ File coverDir = new File(baseDir, source);
+ if (coverDir.isDirectory()) {
+ File cover = new File(coverDir, ".cover.png");
+ InputStream in;
+ try {
+ in = new FileInputStream(cover);
+ try {
+ sourceCovers.put(source, new Image(in));
+ } finally {
+ in.close();
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }