String optSecondary = meta.getAuthor();
if (seeWordCount) {
if (meta.getWords() >= 4000) {
- optSecondary = (meta.getWords() / 1000) + "k words";
+ optSecondary = "" + (meta.getWords() / 1000) + "k";
} else if (meta.getWords() > 0) {
- optSecondary = meta.getWords() + " words";
+ optSecondary = "" + meta.getWords();
} else {
optSecondary = "";
}
+
+ if (!optSecondary.isEmpty()) {
+ if (meta.isImageDocument()) {
+ optSecondary += " images";
+ } else {
+ optSecondary += " words";
+ }
+ }
}
if (optSecondary != null && !optSecondary.isEmpty()) {
BufferedImage resizedImage = null;
String id = null;
- if (meta.getLuid() != null) {
- id = meta.getUuid() + ".thumb_" + SPINE_WIDTH + "x" + COVER_WIDTH
- + "+" + SPINE_HEIGHT + "+" + COVER_HEIGHT + "@" + HOFFSET;
- InputStream in = Instance.getCache().getFromCache(id);
- if (in != null) {
- try {
- resizedImage = ImageUtils.fromStream(in);
- in.close();
- in = null;
- } catch (IOException e) {
- Instance.syserr(e);
- }
+ String key = meta.getUuid();
+ if (key == null) {
+ // a fake meta (a source)
+ key = "source_" + meta.getSource();
+ }
+
+ id = key + ".thumb_" + SPINE_WIDTH + "x" + COVER_WIDTH + "+"
+ + SPINE_HEIGHT + "+" + COVER_HEIGHT + "@" + HOFFSET;
+ InputStream in = Instance.getCache().getFromCache(id);
+ if (in != null) {
+ try {
+ resizedImage = ImageUtils.fromStream(in);
+ in.close();
+ in = null;
+ } catch (IOException e) {
+ Instance.syserr(e);
}
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(resizedImage, "png", out);
byte[] imageBytes = out.toByteArray();
- InputStream in = new ByteArrayInputStream(imageBytes);
+ in = new ByteArrayInputStream(imageBytes);
Instance.getCache().addToCache(in, id);
in.close();
in = null;