From dfbc4d8ef09f9aa2deb4597184523dd316fa8071 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Mon, 4 May 2015 19:48:13 +0300 Subject: [PATCH] support for indexing WebM videos --- .../meviz/htmlindexer/AbstractIndexer.java | 2 + .../svjatoslav/meviz/htmlindexer/Layout.java | 2 + .../htmlindexer/layouts/MixedLayout.java | 38 ++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/AbstractIndexer.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/AbstractIndexer.java index fff1b68..294189b 100644 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/AbstractIndexer.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/AbstractIndexer.java @@ -44,6 +44,8 @@ public abstract class AbstractIndexer { if ("ogv".equals(fileExtension)) layout.enlistOgv(file, directory); + else if ("webm".equals(fileExtension)) + layout.enlistWebm(file, directory); else layout.enlistFile(file, directory); diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/Layout.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/Layout.java index b41d83a..4a21863 100755 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/Layout.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/Layout.java @@ -76,4 +76,6 @@ public interface Layout { */ public void init(String galleryTitle, List path, final AbstractIndexer indexer, IndexingContext context); + + public void enlistWebm(AbstractFile file, DirectoryMetadata directory); } diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java index fd70b10..f721ba6 100755 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/layouts/MixedLayout.java @@ -164,7 +164,7 @@ public class MixedLayout implements Layout { filesHtml.append("download as OGV"); + + file.fileName) + "\">download as OGV file"); filesHtml.append("\n"); @@ -272,4 +272,40 @@ public class MixedLayout implements Layout { return html.toString(); } + @Override + public void enlistWebm(AbstractFile abstractFile, + DirectoryMetadata directory) { + final GeneralFile file = (GeneralFile) abstractFile; + + filesHtml.append("
"); + + // watchable video + + String fileUrl = indexingContext.getGlobalUrl() + + UrlParamEncoder.encode(indexingContext.getLocalUrl() + "/" + + file.fileName); + + filesHtml.append("\n"); + filesHtml.append("
\n"); + + // video title + filesHtml + .append("Video: " + + FilePathParser + .getFileNameWithoutExtension(file.fileName) + + "            "); + + // video download link + filesHtml.append("download as WebM file"); + + filesHtml.append("
\n"); + + filesHtml.append("\n"); + } } -- 2.20.1