import be.nikiroo.fanfix.output.BasicOutput.OutputType;
import be.nikiroo.fanfix.output.InfoCover;
import be.nikiroo.fanfix.supported.InfoReader;
+import be.nikiroo.utils.HashUtils;
import be.nikiroo.utils.IOUtils;
import be.nikiroo.utils.Image;
import be.nikiroo.utils.Progress;
-import be.nikiroo.utils.StringUtils;
/**
* This {@link BasicLibrary} will store the stories locally on disk.
}
@Override
- protected int getNextId() {
+ protected String getNextId() {
getStories(null); // make sure lastId is set
synchronized (lock) {
- return ++lastId;
+ return String.format("%03d", ++lastId);
}
}
in = new FileInputStream(cover);
try {
synchronized (lock) {
- sourceCovers.put(source, new Image(in));
+ Image img = new Image(in);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ sourceCovers.put(source, img);
}
} finally {
in.close();
in = new FileInputStream(cover);
try {
synchronized (lock) {
- authorCovers.put(author, new Image(in));
+ Image img = new Image(in);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ authorCovers.put(author, img);
}
} finally {
in.close();
*/
private File getAuthorCoverFile(String author) {
File aDir = new File(baseDir, "_AUTHORS");
- String hash = StringUtils.getMd5Hash(author);
+ String hash = HashUtils.md5(author);
String ext = Instance.getInstance().getConfig()
.getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER);
return new File(aDir, hash + "." + ext.toLowerCase());
files.add(coverFile);
}
+ String summaryExt = ".summary";
+ File summaryFile = new File(path + summaryExt);
+ if (!summaryFile.exists()) {
+ summaryFile = new File(
+ path.substring(0, path.length() - fileExt.length())
+ + summaryExt);
+ }
+
+ if (summaryFile.exists()) {
+ files.add(summaryFile);
+ }
+
return files;
}
}
for (File infoFileOrSubdir : infoFilesAndSubdirs) {
- if (pgFiles != null) {
- pgFiles.setName(infoFileOrSubdir.getName());
- }
-
if (infoFileOrSubdir.isDirectory()) {
addToStories(stories, null, infoFileOrSubdir);
} else {