private final File directoryToIndex;
- private String thumbnailsPath;
-
private File metadataFile;
private DirectoryMetadata metadata;
return Utils.isMevizGeneratedIndexFile(indexFile);
}
- public void cleanupUnusedMetadataFiles() {
- final File thumbnailsDirectory = new File(thumbnailsPath);
-
- for (final File file : thumbnailsDirectory.listFiles())
- if (!validMetadataFiles.contains(file.getName()))
- file.delete();
- }
-
public void generateHtmlFromMetadata(final HashSet<Layout> layouts) {
// Generate HTML from metadata
for (final Layout layout : layouts)
.getRelativeThumbnailFileName(desiredDimension);
validMetadataFiles.add(thumbnailFileName);
- final File thumbnailFile = new File(thumbnailsPath + thumbnailFileName);
+ final File thumbnailFile = new File(
+ Utils.getThumbnailsDirectoryPath(directoryToIndex)
+ + thumbnailFileName);
if (!thumbnailFile.exists()) {
}
public void loadOrCreateMetadata() {
- metadataFile = new File(thumbnailsPath + Constants.METADATA_FILE_NAME);
+
+ metadataFile = new File(
+ Utils.getThumbnailsDirectoryPath(directoryToIndex)
+ + Constants.METADATA_FILE_NAME);
metadata = MetadadaHelper.initDirectoryMetadata(metadataFile);
}
private void removeUnusedThumbnailFiles() {
- final File thumbnailsDirectory = new File(thumbnailsPath);
-
- for (final File file : thumbnailsDirectory.listFiles())
+ for (final File file : Utils.getThumbnailsDirectory(directoryToIndex)
+ .listFiles())
if (!validMetadataFiles.contains(file.getName()))
file.delete();
}
public static File getThumbnailsDirectory(final File directoryToIndex) {
- return new File(directoryToIndex.getAbsolutePath() + "/"
- + Constants.THUMBNAILS_DIRECTORY_NAME + "/");
+ return new File(getThumbnailsDirectoryPath(directoryToIndex));
+ }
+
+ public static String getThumbnailsDirectoryPath(final File directoryToIndex) {
+ return directoryToIndex.getAbsolutePath() + "/"
+ + Constants.THUMBNAILS_DIRECTORY_NAME + "/";
}
public static boolean isMevizGeneratedIndexFile(final File indexFile)