Code refactoring
[meviz.git] / src / main / java / eu / svjatoslav / meviz / htmlindexer / layouts / MixedLayout.java
index 7963582..49ffa7e 100755 (executable)
@@ -1,30 +1,29 @@
 /*
  * Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012 -- 2018, 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.layouts;
 
 import eu.svjatoslav.commons.file.FilePathParser;
-import eu.svjatoslav.meviz.htmlindexer.AbstractIndexer;
+import eu.svjatoslav.meviz.htmlindexer.indexer.AbstractIndexer;
 import eu.svjatoslav.meviz.htmlindexer.Constants;
 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.Picture;
+import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Video;
 import org.apache.log4j.Logger;
 
 import java.io.IOException;
 import java.util.List;
 
 import static eu.svjatoslav.commons.file.FilePathParser.getFileNameWithoutExtension;
-import static eu.svjatoslav.meviz.htmlindexer.AbstractIndexer.getVideoType;
 import static eu.svjatoslav.meviz.htmlindexer.Utils.urlEncode;
 
 public class MixedLayout implements Layout {
@@ -242,25 +241,24 @@ public class MixedLayout implements Layout {
     }
 
     @Override
-    public void enlistVideo(AbstractFile file) {
+    public void enlistVideo(Video video) {
 
         filesHtml.append("<div style=\"margin: 30px; clear: both;\">\n");
 
         // watchable video
         filesHtml.append("  <video width=\"640\" controls>\n");
-        filesHtml.append("    <source src=\"" + getFileUrl(file) + "\" type=\""
-                + getVideoType(file.getFileExtension()) + "\"/>\n");
+        filesHtml.append("    <source src=\"" + getFileUrl(video) + "\" type=\"" + video.mimeType + "\"/>\n");
         filesHtml.append("  </video>\n");
 
         filesHtml.append("  <br/>\n");
 
         // video title
         filesHtml.append("  Video: <b>"
-                        + getFileNameWithoutExtension(file.fileName)
+                        + getFileNameWithoutExtension(video.fileName)
                         + "<b/>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
 
         // video download link
-        filesHtml.append("  <a href=\"" + getFileUrl(file) + "\">download</a>\n");
+        filesHtml.append("  <a href=\"" + getFileUrl(video) + "\">download</a>\n");
 
         filesHtml.append("</div>\n");