/**
* Create a new {@link LocalLibrary} with the given back-end directory.
*
- * @param baseDir the directory where to find the {@link Story} objects
- * @param config the configuration used to know which kind of default
- * {@link OutputType} to use for images and non-images stories
+ * @param baseDir
+ * the directory where to find the {@link Story} objects
+ * @param config
+ * the configuration used to know which kind of default
+ * {@link OutputType} to use for images and non-images stories
*/
public LocalLibrary(File baseDir, ConfigBundle config) {
this(baseDir, //
config.getString(Config.FILE_FORMAT_NON_IMAGES_DOCUMENT_TYPE),
- config.getString(Config.FILE_FORMAT_IMAGES_DOCUMENT_TYPE), false);
+ config.getString(Config.FILE_FORMAT_IMAGES_DOCUMENT_TYPE),
+ false);
}
/**
*/
public LocalLibrary(File baseDir, String text, String image,
boolean defaultIsHtml) {
- this(baseDir, OutputType.valueOfAllOkUC(text,
- defaultIsHtml ? OutputType.HTML : OutputType.INFO_TEXT),
+ this(baseDir,
+ OutputType.valueOfAllOkUC(text,
+ defaultIsHtml ? OutputType.HTML : OutputType.INFO_TEXT),
OutputType.valueOfAllOkUC(image,
defaultIsHtml ? OutputType.HTML : OutputType.CBZ));
}
@Override
public File getFile(String luid, Progress pg) throws IOException {
- Instance.getInstance().getTraceHandler().trace(this.getClass().getSimpleName() + ": get file for " + luid);
+ Instance.getInstance().getTraceHandler().trace(
+ this.getClass().getSimpleName() + ": get file for " + luid);
File file = null;
String mess = "no file found for ";
}
Instance.getInstance().getTraceHandler()
- .trace(this.getClass().getSimpleName() + ": " + mess + luid + " (" + meta.getTitle() + ")");
+ .trace(this.getClass().getSimpleName() + ": " + mess + luid
+ + " (" + meta.getTitle() + ")");
return file;
}
// Maybe also adding some rollback cleanup if possible
if (relatedFile.getName().endsWith(".info")) {
try {
- String name = relatedFile.getName().replaceFirst(
- "\\.info$", "");
+ String name = relatedFile.getName().replaceFirst("\\.info$",
+ "");
relatedFile.delete();
InfoCover.writeInfo(newDir, name, meta);
relatedFile.getParentFile().delete();
e.printStackTrace();
} catch (IOException e) {
Instance.getInstance().getTraceHandler()
- .error(new IOException("Cannot load the existing custom source cover: " + cover, e));
+ .error(new IOException(
+ "Cannot load the existing custom source cover: "
+ + cover,
+ e));
}
}
}
e.printStackTrace();
} catch (IOException e) {
Instance.getInstance().getTraceHandler()
- .error(new IOException("Cannot load the existing custom author cover: " + cover, e));
+ .error(new IOException(
+ "Cannot load the existing custom author cover: "
+ + cover,
+ e));
}
}
dir.mkdirs();
File cover = new File(dir, ".cover");
try {
- Instance.getInstance().getCache().saveAsImage(coverImage, cover, true);
+ Instance.getInstance().getCache().saveAsImage(coverImage, cover,
+ true);
if (sourceCovers != null) {
sourceCovers.put(source, coverImage);
}
File cover = getAuthorCoverFile(author);
cover.getParentFile().mkdirs();
try {
- Instance.getInstance().getCache().saveAsImage(coverImage, cover, true);
+ Instance.getInstance().getCache().saveAsImage(coverImage, cover,
+ true);
if (authorCovers != null) {
authorCovers.put(author, coverImage);
}
if (title.length() > 40) {
title = title.substring(0, 40);
}
- return new File(getExpectedDir(key.getSource()), key.getLuid() + "_"
- + title);
+ return new File(getExpectedDir(key.getSource()),
+ key.getLuid() + "_" + title);
}
/**
private File getAuthorCoverFile(String author) {
File aDir = new File(baseDir, "_AUTHORS");
String hash = StringUtils.getMd5Hash(author);
- String ext = Instance.getInstance().getConfig().getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER);
+ String ext = Instance.getInstance().getConfig()
+ .getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER);
return new File(aDir, hash + "." + ext.toLowerCase());
}
}
}
- String coverExt = "."
- + Instance.getInstance().getConfig().getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER).toLowerCase();
+ String coverExt = "." + Instance.getInstance().getConfig()
+ .getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER).toLowerCase();
File coverFile = new File(path + coverExt);
if (!coverFile.exists()) {
- coverFile = new File(path.substring(0,
- path.length() - fileExt.length())
- + coverExt);
+ coverFile = new File(
+ path.substring(0, path.length() - fileExt.length())
+ + coverExt);
}
if (coverFile.exists()) {
addToStories(null, infoFileOrSubdir);
} else {
try {
- MetaData meta = InfoReader
- .readMeta(infoFileOrSubdir, false);
+ MetaData meta = InfoReader.readMeta(infoFileOrSubdir,
+ false);
try {
int id = Integer.parseInt(meta.getLuid());
if (id > lastId) {
} catch (IOException e) {
// We should not have not-supported files in the
// library
- Instance.getInstance().getTraceHandler()
- .error(new IOException("Cannot load file from library: " + infoFileOrSubdir, e));
+ Instance.getInstance().getTraceHandler().error(
+ new IOException("Cannot load file from library: "
+ + infoFileOrSubdir, e));
}
}