public void compileHtml(final Layout layout,
final DirectoryMetadata directory)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
for (final AbstractFile file : directory.getFiles())
if (file instanceof GeneralFile) {
final String fileExtension = file.getFileExtension();
if ("ogv".equals(fileExtension))
- layout.enlistOgv(file);
+ layout.enlistOgv(file, directory);
else
- layout.enlistFile(file);
+ layout.enlistFile(file, directory);
} else if (file instanceof Picture)
- layout.enlistImage((Picture) file);
+ layout.enlistImage((Picture) file, directory);
else if (file instanceof DirectoryFile)
- layout.enlistDirectory(file);
+ layout.enlistDirectory(file, directory);
}
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import eu.svjatoslav.meviz.htmlindexer.metadata.DirectoryMetadata;
import eu.svjatoslav.meviz.htmlindexer.metadata.MetadadaHelper;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.AbstractFile;
-import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.DirectoryFile;
-import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.GeneralFile;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Picture;
/**
if (canWriteIndexFile(indexFile)) {
- indexForLayout(layout);
+ compileHtml(layout, metadata);
IOHelper.overwriteFileIfContentDiffers(indexFile, layout
.getHtml(true, true).getBytes());
validMetadataFiles.add(thumbnailFileName);
final File thumbnailFile = new File(
Utils.getThumbnailsDirectoryPath(directoryToIndex)
- + thumbnailFileName);
+ + thumbnailFileName);
if (!thumbnailFile.exists()) {
desiredDimension.getAwtDimension());
}
return Constants.THUMBNAILS_DIRECTORY_NAME + "/"
- + UrlParamEncoder.encode(thumbnailFileName);
- }
-
- public void indexForLayout(final Layout layout)
- throws UnsupportedEncodingException {
-
- for (final AbstractFile abstractFile : metadata.getFiles())
- if (abstractFile instanceof GeneralFile) {
-
- if (isOgv(abstractFile.getFileExtension()))
- layout.enlistOgv(abstractFile);
- else
- layout.enlistFile(abstractFile);
-
- } else if (abstractFile instanceof Picture)
- layout.enlistImage((Picture) abstractFile);
- else if (abstractFile instanceof DirectoryFile)
- layout.enlistDirectory(abstractFile);
-
+ + UrlParamEncoder.encode(thumbnailFileName);
}
public void initializeLayouts() {
metadataFile = new File(
Utils.getThumbnailsDirectoryPath(directoryToIndex)
- + Constants.METADATA_FILE_NAME);
+ + Constants.METADATA_FILE_NAME);
metadata = MetadadaHelper.initDirectoryMetadata(metadataFile);
}
import java.io.UnsupportedEncodingException;
import java.util.List;
+import eu.svjatoslav.meviz.htmlindexer.metadata.DirectoryMetadata;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.AbstractFile;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Picture;
/**
* Enlist directory.
*/
- public void enlistDirectory(AbstractFile directory);
+ public void enlistDirectory(AbstractFile directory,
+ DirectoryMetadata parentDirectoryMetadata);
/**
* Enlist simple file.
*/
- public void enlistFile(AbstractFile file);
+ public void enlistFile(AbstractFile file,
+ DirectoryMetadata parentDirectoryMetadata);
/**
* Enlist image file.
*/
- public void enlistImage(Picture picture);
+ public void enlistImage(Picture picture,
+ DirectoryMetadata parentDirectoryMetadata);
/**
* Enlist video in OGV format.
*
* @throws UnsupportedEncodingException
*/
- public void enlistOgv(AbstractFile file)
+ public void enlistOgv(AbstractFile file,
+ DirectoryMetadata parentDirectoryMetadata)
throws UnsupportedEncodingException;
/**
import eu.svjatoslav.meviz.htmlindexer.IndexingContext;
import eu.svjatoslav.meviz.htmlindexer.Layout;
import eu.svjatoslav.meviz.htmlindexer.metadata.Dimension;
+import eu.svjatoslav.meviz.htmlindexer.metadata.DirectoryMetadata;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.AbstractFile;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.GeneralFile;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Picture;
private IndexingContext indexingContext;
@Override
- public void enlistDirectory(final AbstractFile directory) {
+ public void enlistDirectory(final AbstractFile directory,
+ final DirectoryMetadata parentDirectoryMetadata) {
dirHtml.append("<TR>");
dirHtml.append("<TD><b><a href=\""
+ indexer.getDirectoryUrl(directory, indexingContext)
}
@Override
- public void enlistFile(final AbstractFile file) {
+ public void enlistFile(final AbstractFile file,
+ final DirectoryMetadata parentDirectoryMetadata) {
final String fullFileName = file.fileName;
}
@Override
- public void enlistImage(final Picture picture) {
+ public void enlistImage(final Picture picture,
+ final DirectoryMetadata parentDirectoryMetadata) {
try {
final Dimension imageSize = picture.getDimensions();
+ e.toString()
+ ", thumbnail generation skipped, enlisting as ordinary file instead.",
e);
- enlistFile(picture);
+ enlistFile(picture, parentDirectoryMetadata);
}
}
/** {@inheritDoc} */
@Override
- public void enlistOgv(final AbstractFile abstractFile)
+ public void enlistOgv(final AbstractFile abstractFile,
+ final DirectoryMetadata parentDirectoryMetadata)
throws UnsupportedEncodingException {
final GeneralFile file = (GeneralFile) abstractFile;
return new GeneralFile(parentDirectory, fileName);
}
- if (fileExtension.equals("meviz"))
+ if (fileName.endsWith(".meviz.org"))
+ return new MevizSpecialFile(parentDirectory, fileName);
+
+ if (fileName.endsWith(".meviz.html"))
return new MevizSpecialFile(parentDirectory, fileName);
return new GeneralFile(parentDirectory, fileName);