diff --git a/bin/getInfo.sh b/bin/getInfo.sh
new file mode 100644
index 0000000..69fe85b
--- /dev/null
+++ b/bin/getInfo.sh
@@ -0,0 +1,19 @@
+#!/bin/bash/
+finalDest=/srv/http/sovigall.local/videos/
+pageCache=/srv/http/sovigall.local/pagecache/
+convertingTool=/usr/bin/ffmpeg
+
+video=$1
+path="$finalDest$2"
+
+duration=$(eval $convertingTool -i "$path""$video.webm" 2>&1 | grep Duration | awk '{print $2}' | tr -d ,)
+heure=$(echo $duration | cut -d":" -f1)
+minute=$(echo $duration | cut -d":" -f2)
+seconde=$(echo $duration | cut -d":" -f3 | cut -d"." -f1)
+total=$(($heure*3600 + $minute*60 + $seconde))
+sizeOfVideo=$(eval $convertingTool -i "$path""$video.webm" 2>&1 | grep "Stream #0:0" | awk '{print $6}' | tr -d ,)
+#createDate=$(stat -c %y "$path""$video.webm" 2>&1 | awk '{print$1}' | sed 's/[\-]//g')
+echo "$total"
+echo "$sizeOfVideo"
+#echo "$createDate"
+rm $pageCache*.html 2> /dev/null
diff --git a/inc/content.php b/inc/content.php
index c9a30f3..bb96de9 100644
--- a/inc/content.php
+++ b/inc/content.php
@@ -231,6 +231,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
+
';
}
if ($GLOBALS['config']['DOWNLOAD_METHOD'] === 'xsendfile' || $GLOBALS['config']['DOWNLOAD_METHOD'] === 'php') {
diff --git a/index.php b/index.php
index b5030e7..0bd4430 100644
--- a/index.php
+++ b/index.php
@@ -277,9 +277,9 @@ function n_print($data, $name = '') {
';
@@ -365,7 +365,7 @@ function addVideo($ci, $fullListFile) {
file_put_contents($GLOBALS['config']['LISTFILE'], "");
}
-function redownloadVideo($bc, $file){
+function redownloadVideo($bc, $file) {
$path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/');
$pathAndFile = $path.$file;
rename($pathAndFile.'.hash', $GLOBALS['config']['TMPDIR'].'/'.$file.'.hash');
@@ -513,6 +513,17 @@ function makeRss($breadcrumb, $fullListFile) {
exit();
}
+function updateVideoInfo($dc,$file) {
+ $path = chunk_split($dc, 8, '/');
+ $file = escapeshellcmd($file);
+ $bc = escapeshellcmd($path);
+ exec('bash bin/getInfo.sh '.$file.' '.$bc, $result);
+ $jsonFile = json_decode(file_get_contents($GLOBALS['config']['VIDEODIR'].'/'.$path.$file.'.info.json'));
+ $jsonFile -> duration = $result[0];
+ $jsonFile -> format = '0 - '.$result[1];
+ file_put_contents($GLOBALS['config']['VIDEODIR'].'/'.$path.$file.'.info.json', json_encode($jsonFile));
+}
+
function parseVideoDescription($file, $fullInfo = false) {
$value = json_decode(file_get_contents($file));
}
@@ -521,7 +532,7 @@ function getVideoInfo($file, $dir, $fullListFile) {
$file = substr($file, 0, 10);
$postInfo = $fullListFile[$file];
$path = chunk_split($dir, 8, '/');
- $descFile = glob($GLOBALS['config']['VIDEODIR']."/".$path.$file."*.json");
+ $descFile = glob($GLOBALS['config']['VIDEODIR'].'/'.$path.$file.'*.json');
$jsonInfo = json_decode(file_get_contents($descFile[0]));
$jsonSize = explode(' - ', htmlentities($jsonInfo -> format));
$jsonSize = explode('x', $jsonSize[1]);
@@ -795,13 +806,20 @@ if (isset($ci['ac']) && !empty($ci['ac'])) {
}
cutVideo($ci['bc'], $ci['file']);
}
- if ($ci['ac'] === 'view' && !empty($ci['op']) && $ci['op'] === 'reDownload') {
+ if ($ci['ac'] === 'view' && !empty($ci['op']) && $ci['op'] === 'reDownload') {
verifToken($ci['token']);
if (!isLog()) {
die('Tinker say : Blinded you, with Science! ');
}
reDownloadVideo($ci['bc'], $ci['file']);
}
+ if ($ci['ac'] === 'view' && !empty($ci['op']) && $ci['op'] === 'updateInfo') {
+ verifToken($ci['token']);
+ if (!isLog()) {
+ die('Tinker say : Blinded you, with Science! ');
+ }
+ updateVideoInfo($ci['bc'], $ci['file']);
+ }
if ($ci['ac'] === 'viewQueue' || $ci['ac'] === 'clearCache') {
verifToken($ci['token']);
if (!isLog()) {