/*
* Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * Copyright (C) 2012 -- 2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- */
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+*/
package eu.svjatoslav.meviz.htmlindexer;
public class FilesystemIndexer extends AbstractIndexer {
- public static final Logger logger = Logger
+ private static final Logger logger = Logger
.getLogger(FilesystemIndexer.class);
- private final HashSet<String> validMetadataFiles = new HashSet<String>();
+ private final HashSet<String> validMetadataFiles = new HashSet<>();
private final File directoryToIndex;
private final List<String> pathElements;
}
- public boolean canWriteIndexFile(final File indexFile)
+ private boolean canWriteIndexFile(final File indexFile)
throws IOException {
return !indexFile.exists() || Utils.isMevizGeneratedIndexFile(indexFile);
}
- public void generateHtmlFromMetadata(final HashSet<Layout> layouts) {
+ private void generateHtmlFromMetadata(final HashSet<Layout> layouts) {
// Generate HTML from metadata
for (final Layout layout : layouts)
try {
}
}
- public List<String> getChildPath(final File file) {
+ private List<String> getChildPath(final File file) {
- final List<String> result = new ArrayList<String>();
+ final List<String> result = new ArrayList<>();
result.addAll(pathElements);
result.add(file.getName());
+ Utils.urlEncode(thumbnailFileName);
}
- public void initializeLayouts() {
+ private void initializeLayouts() {
layouts = Utils.getLayouts();
"", "."));
}
- public void initializeThumbnailsDirectory() {
+ private void initializeThumbnailsDirectory() {
final File thumbnailsDirectory = Utils
.getThumbnailsDirectory(directoryToIndex);
thumbnailsDirectory.mkdirs();
}
- public void loadOrCreateMetadata() {
+ private void loadOrCreateMetadata() {
metadataFile = new File(
Utils.getThumbnailsDirectoryPath(directoryToIndex)
}
- public void updateMetadata() throws Exception {
+ private void updateMetadata() throws Exception {
for (final File file : directoryToIndex.listFiles())
if (shallFileBeIndexed(file)) {
- metadata.ensureFileMetainfoIsUpToDate(directoryToIndex, file);
+ metadata.ensureFileMetadataIsUpToDate(directoryToIndex, file);
if (file.isDirectory())
new FilesystemIndexer(file, commandlineHandler,