- sourceCovers.put(source, coverImage);
- File cover = new File(getExpectedDir(source), ".cover");
- try {
- Instance.getCache().saveAsImage(sourceCovers.get(source), cover,
- true);
- } catch (IOException e) {
- Instance.getTraceHandler().error(e);
- sourceCovers.remove(source);
+ for (File infoFileOrSubdir : infoFilesAndSubdirs) {
+ if (infoFileOrSubdir.isDirectory()) {
+ addToStories(stories, null, infoFileOrSubdir);
+ } else {
+ try {
+ MetaData meta = InfoReader.readMeta(infoFileOrSubdir,
+ false);
+ try {
+ int id = Integer.parseInt(meta.getLuid());
+ if (id > lastId) {
+ lastId = id;
+ }
+
+ stories.put(meta, new File[] { infoFileOrSubdir,
+ getTargetFile(meta, infoFileOrSubdir) });
+ } catch (Exception e) {
+ // not normal!!
+ throw new IOException("Cannot understand the LUID of "
+ + infoFileOrSubdir + ": " + meta.getLuid(), e);
+ }
+ } 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));
+ }
+ }
+
+ if (pgFiles != null) {
+ pgFiles.add(1);
+ }