import java.io.IOException;
import java.io.OutputStreamWriter;
-import javax.imageio.ImageIO;
-
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.bundles.Config;
import be.nikiroo.fanfix.data.MetaData;
-class InfoCover {
+public class InfoCover {
public static void writeInfo(File targetDir, String targetName,
MetaData meta) throws IOException {
File info = new File(targetDir, targetName + ".info");
writeMeta(infoWriter, "WORDCOUNT",
Long.toString(meta.getWords()));
writeMeta(infoWriter, "CREATION_DATE", meta.getCreationDate());
+ writeMeta(infoWriter, "FAKE_COVER",
+ Boolean.toString(meta.isFakeCover()));
} finally {
infoWriter.close();
}
MetaData meta) {
if (meta != null && meta.getCover() != null) {
try {
- String format = Instance.getConfig()
- .getString(Config.IMAGE_FORMAT_COVER).toLowerCase();
- ImageIO.write(meta.getCover(), format, new File(targetDir,
- targetName + "." + format));
+ Instance.getCache().saveAsImage(meta.getCover(),
+ new File(targetDir, targetName), true);
} catch (IOException e) {
// Allow to continue without cover
- Instance.syserr(new IOException(
- "Failed to save the cover image", e));
+ Instance.getTraceHandler().error(
+ new IOException("Failed to save the cover image", e));
}
}
}