From 616895d4f75b961b8a4e7a0cd707be01db7647fa Mon Sep 17 00:00:00 2001
From: Knah Tsaeb
Date: Tue, 24 Dec 2019 15:16:41 +0100
Subject: [PATCH] Add video support
---
index.php | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
diff --git a/index.php b/index.php
index 74cfc11..9f09b29 100755
--- a/index.php
+++ b/index.php
@@ -330,7 +330,6 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) {
if (preg_match("/.jpg$|.gif$|.bmp$|.png$/i", $file)) {
$path_parts = pathinfo($file);
if(file_exists($current_dir.'/'.$path_parts['filename'].'.mp4')){
- //continue;
$dataVideo = ' data-video="'.$current_dir.'/'.$path_parts['filename'].'.mp4'.'" ';
if (is_file($current_dir.'/'.$path_parts['filename'].'.info.json')) {
$infoContent = json_decode(file_get_contents($current_dir.'/'.$path_parts['filename'].'.info.json'));
@@ -339,6 +338,7 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) {
} else {
$imgComment = ''.$file . '
';
}
+ $videoWithComment = true;
} else {
$dataVideo = null;
}
@@ -383,28 +383,6 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) {
');
}
- if (preg_match("/\.ogv$|\.mpg$|\.mpeg$|\.mov$|\.avi$|\.wmv$|\.flv$|\.webm$/i", $file)) {
- $linkUrl = str_replace('%2F', '/', rawurlencode("$current_dir/$file"));
- $path_parts = pathinfo($file);
- if(file_exists($current_dir.'/'.$path_parts['filename'].'.jpg')){
- $poster = $current_dir.'/'.$path_parts['filename'].'.jpg';
- } else {
- $poster = '';
- }
- $files[] = array(
- "name" => $file,
- "date" => filemtime($current_dir . "/" . $file),
- "size" => filesize($current_dir . "/" . $file),
- "html" => '
-
-
-
- ' . $filename_caption . '
-
-
');
- }
// Other filetypes
$extension = "";
if (preg_match("/\.pdf$/i", $file)) {
@@ -439,6 +417,10 @@ if (is_dir($current_dir) && $handle = opendir($current_dir)) {
$extension = "XLXS";
}
// Excel
+ if (preg_match("/\.ogv$|\.mp4$|\.mpg$|\.mpeg$|\.mov$|\.avi$|\.wmv$|\.flv$|\.webm$/i", $file) && empty($videoWithComment)) {
+ $extension = "VIDEO";
+ }
+ // video files
if (preg_match("/\.aiff$|\.aif$|\.wma$|\.aac$|\.flac$|\.mp3$|\.ogg$|\.m4a$/i", $file)) {
$extension = "AUDIO";
}