File coverDir = new File(baseDir, source);
if (coverDir.isDirectory()) {
File cover = new File(coverDir, ".cover.png");
- InputStream in;
- try {
- in = new FileInputStream(cover);
+ if (cover.exists()) {
+ InputStream in;
try {
- sourceCovers.put(source, new Image(in));
- } finally {
- in.close();
+ in = new FileInputStream(cover);
+ try {
+ sourceCovers.put(source, new Image(in));
+ } finally {
+ in.close();
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ Instance.getTraceHandler().error(
+ new IOException(
+ "Cannot load the existing custom source cover: "
+ + cover, e));
}
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
}
}
.getSourceCover(meta.getSource());
}
- BufferedImage coverb = ImageUtilsAwt.fromImage(cover);
-
resizedImage = new BufferedImage(SPINE_WIDTH + COVER_WIDTH,
SPINE_HEIGHT + COVER_HEIGHT + HOFFSET,
BufferedImage.TYPE_4BYTE_ABGR);
g.setColor(Color.white);
g.fillRect(0, HOFFSET, COVER_WIDTH, COVER_HEIGHT);
if (cover != null) {
+ BufferedImage coverb = ImageUtilsAwt.fromImage(cover);
g.drawImage(coverb, 0, HOFFSET, COVER_WIDTH, COVER_HEIGHT,
null);
} else {