git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Invalidate info for one luid instead of all
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
library
/
LocalLibrary.java
diff --git
a/src/be/nikiroo/fanfix/library/LocalLibrary.java
b/src/be/nikiroo/fanfix/library/LocalLibrary.java
index 11c36630adcef96ea73d17c8712d84495260299a..92676b3530288eac94244b9b84c4f23c24bd82c8 100644
(file)
--- a/
src/be/nikiroo/fanfix/library/LocalLibrary.java
+++ b/
src/be/nikiroo/fanfix/library/LocalLibrary.java
@@
-122,7
+122,7
@@
public class LocalLibrary extends BasicLibrary {
meta = InfoReader.readMeta(infoFile, true);
return meta.getCover();
} catch (IOException e) {
meta = InfoReader.readMeta(infoFile, true);
return meta.getCover();
} catch (IOException e) {
- Instance.
syser
r(e);
+ Instance.
getTraceHandler().erro
r(e);
}
}
}
}
}
}
@@
-131,7
+131,7
@@
public class LocalLibrary extends BasicLibrary {
}
@Override
}
@Override
- protected void
clearCache(
) {
+ protected void
invalidateInfo(String luid
) {
stories = null;
sourceCovers = new HashMap<String, BufferedImage>();
}
stories = null;
sourceCovers = new HashMap<String, BufferedImage>();
}
@@
-147,6
+147,7
@@
public class LocalLibrary extends BasicLibrary {
for (File file : getRelatedFiles(luid)) {
// TODO: throw an IOException if we cannot delete the files?
IOUtils.deltree(file);
for (File file : getRelatedFiles(luid)) {
// TODO: throw an IOException if we cannot delete the files?
IOUtils.deltree(file);
+ file.getParentFile().delete();
}
}
}
}
@@
-157,7
+158,7
@@
public class LocalLibrary extends BasicLibrary {
File expectedTarget = getExpectedFile(meta);
expectedTarget.getParentFile().mkdirs();
File expectedTarget = getExpectedFile(meta);
expectedTarget.getParentFile().mkdirs();
- BasicOutput it = BasicOutput.getOutput(getOutputType(meta), true);
+ BasicOutput it = BasicOutput.getOutput(getOutputType(meta), true
, true
);
it.process(story, expectedTarget.getPath(), pg);
return story;
it.process(story, expectedTarget.getPath(), pg);
return story;
@@
-182,15
+183,17
@@
public class LocalLibrary extends BasicLibrary {
"\\.info$", "");
InfoCover.writeInfo(newDir, name, meta);
relatedFile.delete();
"\\.info$", "");
InfoCover.writeInfo(newDir, name, meta);
relatedFile.delete();
+ relatedFile.getParentFile().delete();
} catch (IOException e) {
} catch (IOException e) {
- Instance.
syser
r(e);
+ Instance.
getTraceHandler().erro
r(e);
}
} else {
relatedFile.renameTo(new File(newDir, relatedFile.getName()));
}
} else {
relatedFile.renameTo(new File(newDir, relatedFile.getName()));
+ relatedFile.getParentFile().delete();
}
}
}
}
-
clearCache
();
+
invalidateInfo
();
}
@Override
}
@Override
@@
-209,7
+212,7
@@
public class LocalLibrary extends BasicLibrary {
try {
ImageIO.write(sourceCovers.get(source), "png", cover);
} catch (IOException e) {
try {
ImageIO.write(sourceCovers.get(source), "png", cover);
} catch (IOException e) {
- Instance.
syser
r(e);
+ Instance.
getTraceHandler().erro
r(e);
sourceCovers.remove(source);
}
}
sourceCovers.remove(source);
}
}
@@
-261,7
+264,7
@@
public class LocalLibrary extends BasicLibrary {
pg.add(1);
}
pg.add(1);
}
-
clearCache
();
+
invalidateInfo
();
pg.done();
return;
}
pg.done();
return;
}
@@
-269,7
+272,7
@@
public class LocalLibrary extends BasicLibrary {
super.imprt(other, luid, pg);
super.imprt(other, luid, pg);
-
clearCache
();
+
invalidateInfo
();
}
/**
}
/**
@@
-383,7
+386,8
@@
public class LocalLibrary extends BasicLibrary {
}
String coverExt = "."
}
String coverExt = "."
- + Instance.getConfig().getString(Config.IMAGE_FORMAT_COVER);
+ + Instance.getConfig().getString(Config.IMAGE_FORMAT_COVER)
+ .toLowerCase();
File coverFile = new File(path + coverExt);
if (!coverFile.exists()) {
coverFile = new File(path.substring(0,
File coverFile = new File(path + coverExt);
if (!coverFile.exists()) {
coverFile = new File(path.substring(0,
@@
-403,7
+407,7
@@
public class LocalLibrary extends BasicLibrary {
* {@link LocalLibrary#baseDir}.
* <p>
* Will use a cached list when possible (see
* {@link LocalLibrary#baseDir}.
* <p>
* Will use a cached list when possible (see
- * {@link BasicLibrary#
clearCache
()}).
+ * {@link BasicLibrary#
invalidateInfo
()}).
*
* @param pg
* the optional {@link Progress}
*
* @param pg
* the optional {@link Progress}
@@
-472,8
+476,10
@@
public class LocalLibrary extends BasicLibrary {
} catch (IOException e) {
// We should not have not-supported files in the
// library
} catch (IOException e) {
// We should not have not-supported files in the
// library
- Instance.syserr(new IOException(
- "Cannot load file from library: " + infoFile, e));
+ Instance.getTraceHandler().error(
+ new IOException(
+ "Cannot load file from library: "
+ + infoFile, e));
}
pgFiles.add(1);
}
}
pgFiles.add(1);
}
@@
-489,7
+495,7
@@
public class LocalLibrary extends BasicLibrary {
in.close();
}
} catch (IOException e) {
in.close();
}
} catch (IOException e) {
- Instance.
syser
r(e);
+ Instance.
getTraceHandler().erro
r(e);
}
}
}
}
@@
-516,7
+522,7
@@
public class LocalLibrary extends BasicLibrary {
try {
ImageIO.write(sourceCovers.get(source), "png", cover);
} catch (IOException e) {
try {
ImageIO.write(sourceCovers.get(source), "png", cover);
} catch (IOException e) {
- Instance.
syser
r(e);
+ Instance.
getTraceHandler().erro
r(e);
sourceCovers.remove(source);
}
}
sourceCovers.remove(source);
}
}