[add] video can be re-download

This commit is contained in:
Knah Tsaeb 2015-01-30 15:09:21 +01:00
parent 17659173e3
commit c83f4b2388
3 changed files with 557 additions and 9 deletions

534
images/reload.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -230,6 +230,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
<a href="?ac=view&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '&amp;op=cutVideo"><img src="images/cut.svg" alt="Cut this video" title="Cut this video"/></a> <a href="?ac=view&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '&amp;op=cutVideo"><img src="images/cut.svg" alt="Cut this video" title="Cut this video"/></a>
<a href="?ac=view&amp;op=3&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '"><img src="images/useThumbnail.svg" alt="Use this thumbnail for folder thumbnail" title="Use this thumbnail for folder thumbnail"/></a> <a href="?ac=view&amp;op=3&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '"><img src="images/useThumbnail.svg" alt="Use this thumbnail for folder thumbnail" title="Use this thumbnail for folder thumbnail"/></a>
<a href="?ac=view&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '&amp;op=confDelVideo"><img src="images/delete.svg" alt="Delete this video" title="Delete this video"/></a> <a href="?ac=view&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '&amp;op=confDelVideo"><img src="images/delete.svg" alt="Delete this video" title="Delete this video"/></a>
<a href="?ac=view&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '&amp;op=reDownload"><img src="images/reload.svg" alt="Re-download" title="Re-download"/></a>
</div>'; </div>';
} }
if ($GLOBALS['config']['DOWNLOAD_METHOD'] === 'xsendfile' || $GLOBALS['config']['DOWNLOAD_METHOD'] === 'php') { if ($GLOBALS['config']['DOWNLOAD_METHOD'] === 'xsendfile' || $GLOBALS['config']['DOWNLOAD_METHOD'] === 'php') {

View file

@ -348,7 +348,7 @@ function addVideo($ci, $fullListFile) {
} else { } else {
$path = ''; $path = '';
} }
if(isset($ci['ddl']) && (int)$ci['ddl'] === 1){ if (isset($ci['ddl']) && (int)$ci['ddl'] === 1) {
$ddl = 1; $ddl = 1;
} else { } else {
$ddl = 0; $ddl = 0;
@ -365,6 +365,12 @@ function addVideo($ci, $fullListFile) {
file_put_contents($GLOBALS['config']['LISTFILE'], "<?php\n\$fullListFile=".var_export($fullListFile, true).";\n?>"); file_put_contents($GLOBALS['config']['LISTFILE'], "<?php\n\$fullListFile=".var_export($fullListFile, true).";\n?>");
} }
function redownloadVideo($bc, $file){
$path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/');
$pathAndFile = $path.$file;
rename($pathAndFile.'.hash', $GLOBALS['config']['TMPDIR'].'/'.$file.'.hash');
}
function deleteVideo($bc, $file) { function deleteVideo($bc, $file) {
$path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/'); $path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/');
$pathAndFile = $path.$file; $pathAndFile = $path.$file;
@ -486,7 +492,7 @@ function makeRss($breadcrumb, $fullListFile) {
<link>http://'.$_SERVER['HTTP_HOST'].'</link>'; <link>http://'.$_SERVER['HTTP_HOST'].'</link>';
foreach ($allFile as $value) { foreach ($allFile as $value) {
$oriValues = $value; $oriValues = $value;
$hash = substr(str_replace('.webm','',$oriValues),-10, 10); $hash = substr(str_replace('.webm', '', $oriValues), -10, 10);
$rss .= ' $rss .= '
<item> <item>
<title>'.html_entity_decode($fullListFile[$hash]['title'], ENT_QUOTES, "UTF-8").'</title> <title>'.html_entity_decode($fullListFile[$hash]['title'], ENT_QUOTES, "UTF-8").'</title>
@ -522,8 +528,8 @@ function getVideoInfo($file, $dir, $fullListFile) {
$size = $jsonSize[0].'x'.$jsonSize[1]; $size = $jsonSize[0].'x'.$jsonSize[1];
$time = gmdate('H\hi\ms\s', $jsonInfo -> duration); $time = gmdate('H\hi\ms\s', $jsonInfo -> duration);
$uploadDate = htmlentities($jsonInfo -> upload_date, ENT_QUOTES, "UTF-8"); $uploadDate = htmlentities($jsonInfo -> upload_date, ENT_QUOTES, "UTF-8");
if(empty($uploadDate)){ if (empty($uploadDate)) {
$uploadDate = gmdate ("Ymd", filemtime($GLOBALS['config']['VIDEODIR']."/".$path.$file.".webm")); $uploadDate = gmdate("Ymd", filemtime($GLOBALS['config']['VIDEODIR']."/".$path.$file.".webm"));
} }
$info = array( $info = array(
'hash' => $file, 'hash' => $file,
@ -788,6 +794,13 @@ if (isset($ci['ac']) && !empty($ci['ac'])) {
die('Tinker say : Blinded you, with Science! '); die('Tinker say : Blinded you, with Science! ');
} }
cutVideo($ci['bc'], $ci['file']); cutVideo($ci['bc'], $ci['file']);
}
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'] === 'viewQueue' || $ci['ac'] === 'clearCache') { if ($ci['ac'] === 'viewQueue' || $ci['ac'] === 'clearCache') {
verifToken($ci['token']); verifToken($ci['token']);