mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Improving the videos directory location
This commit is contained in:
parent
822a494387
commit
551379436d
26 changed files with 70 additions and 59 deletions
|
@ -21,7 +21,7 @@ foreach ($videos as $value) {
|
||||||
echo "\nStart: " . $value['title'];
|
echo "\nStart: " . $value['title'];
|
||||||
ob_flush();
|
ob_flush();
|
||||||
$videoFileName = $value['filename'];
|
$videoFileName = $value['filename'];
|
||||||
$destination = "{$global['systemRootPath']}videos/{$videoFileName}.webp";
|
$destination = Video::getStoragePath()."{$videoFileName}.webp";
|
||||||
if (!file_exists($destination)) {
|
if (!file_exists($destination)) {
|
||||||
echo "\nGet webp";
|
echo "\nGet webp";
|
||||||
ob_flush();
|
ob_flush();
|
||||||
|
|
|
@ -15,7 +15,7 @@ echo "Choose an option: ";
|
||||||
ob_flush();
|
ob_flush();
|
||||||
$option = trim(readline(""));
|
$option = trim(readline(""));
|
||||||
|
|
||||||
exec("rm -R {$global['systemRootPath']}videos/cache/*");
|
exec("rm -R Video::getStoragePath()."cache/*");
|
||||||
if ($option == 1) {
|
if ($option == 1) {
|
||||||
$sql = "UPDATE plugins ";
|
$sql = "UPDATE plugins ";
|
||||||
$sql .= " SET object_data = '' WHERE id > 0";
|
$sql .= " SET object_data = '' WHERE id > 0";
|
||||||
|
|
|
@ -88,7 +88,7 @@ if (empty($videoFileName)) {
|
||||||
$video->setFilename($videoFileName);
|
$video->setFilename($videoFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
$destination_local = "{$global['systemRootPath']}videos/{$videoFileName}";
|
$destination_local = Video::getStoragePath()."{$videoFileName}";
|
||||||
|
|
||||||
if (!empty($_FILES)) {
|
if (!empty($_FILES)) {
|
||||||
_error_log("aVideoEncoder.json: Files " . json_encode($_FILES));
|
_error_log("aVideoEncoder.json: Files " . json_encode($_FILES));
|
||||||
|
@ -197,7 +197,7 @@ function downloadVideoFromDownloadURL($downloadURL)
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$_FILES['video']['name'] = basename($downloadURL);
|
$_FILES['video']['name'] = basename($downloadURL);
|
||||||
|
|
||||||
$temp = "{$global['systemRootPath']}videos/cache/tmpFile/" . $_FILES['video']['name'];
|
$temp = Video::getStoragePath()."cache/tmpFile/" . $_FILES['video']['name'];
|
||||||
_error_log("aVideoEncoder.json: save " . $temp);
|
_error_log("aVideoEncoder.json: save " . $temp);
|
||||||
make_path($temp);
|
make_path($temp);
|
||||||
file_put_contents($temp, $file);
|
file_put_contents($temp, $file);
|
||||||
|
|
|
@ -64,7 +64,7 @@ $obj->error = false;
|
||||||
$obj->video_id = $video_id;
|
$obj->video_id = $video_id;
|
||||||
Video::updateFilesize($video_id);
|
Video::updateFilesize($video_id);
|
||||||
// delete original files if any
|
// delete original files if any
|
||||||
$originalFilePath = "{$global['systemRootPath']}videos/original_" . $video->getFilename();
|
$originalFilePath = Video::getStoragePath()."original_" . $video->getFilename();
|
||||||
if(file_exists($originalFilePath)){
|
if(file_exists($originalFilePath)){
|
||||||
unlink($originalFilePath);
|
unlink($originalFilePath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ _error_log("ReceiveImage: "."Encoder receiving post ". json_encode($_FILES));
|
||||||
|
|
||||||
$videoFileName = $video->getFilename();
|
$videoFileName = $video->getFilename();
|
||||||
|
|
||||||
$destination_local = "{$global['systemRootPath']}videos/{$videoFileName}";
|
$destination_local = Video::getStoragePath()."{$videoFileName}";
|
||||||
|
|
||||||
$obj->jpgDest = "{$destination_local}.jpg";
|
$obj->jpgDest = "{$destination_local}.jpg";
|
||||||
if (!empty($_FILES['image']['tmp_name']) && (!file_exists($obj->jpgDest) || filesize($obj->jpgDest)===42342)) {
|
if (!empty($_FILES['image']['tmp_name']) && (!file_exists($obj->jpgDest) || filesize($obj->jpgDest)===42342)) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
|
|
||||||
$mainName = preg_replace("/[^A-Za-z0-9]/", "", cleanString($path_parts['filename']));
|
$mainName = preg_replace("/[^A-Za-z0-9]/", "", cleanString($path_parts['filename']));
|
||||||
$filename = uniqid($mainName . "_YPTuniqid_", true);
|
$filename = uniqid($mainName . "_YPTuniqid_", true);
|
||||||
$originalFilePath = "{$global['systemRootPath']}videos/original_" . $filename;
|
$originalFilePath = Video::getStoragePath()."original_" . $filename;
|
||||||
|
|
||||||
$video = new Video(preg_replace("/_+/", " ", $path_parts['filename']), $filename, @$_FILES['upl']['videoId']);
|
$video = new Video(preg_replace("/_+/", " ", $path_parts['filename']), $filename, @$_FILES['upl']['videoId']);
|
||||||
$video->setDuration($duration);
|
$video->setDuration($duration);
|
||||||
|
@ -157,7 +157,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
}
|
}
|
||||||
$queue[] = $video->queue($postFields);
|
$queue[] = $video->queue($postFields);
|
||||||
|
|
||||||
//exec("/usr/bin/php -f videoEncoder.php {$_FILES['upl']['tmp_name']} {$filename} 1> {$global['systemRootPath']}videos/{$filename}_progress.txt 2>&1", $output, $return_val);
|
//exec("/usr/bin/php -f videoEncoder.php {$_FILES['upl']['tmp_name']} {$filename} 1> Video::getStoragePath()."{$filename}_progress.txt 2>&1", $output, $return_val);
|
||||||
//var_dump($output, $return_val);
|
//var_dump($output, $return_val);
|
||||||
//echo '{"status":"success", "msg":"Your video (' . $filename . ') is encoding <br> ' . $cmd . '", "filename":"' . $filename . '", "duration":"' . $duration . '"}';
|
//echo '{"status":"success", "msg":"Your video (' . $filename . ') is encoding <br> ' . $cmd . '", "filename":"' . $filename . '", "duration":"' . $duration . '"}';
|
||||||
status(["status" => "success"
|
status(["status" => "success"
|
||||||
|
|
|
@ -246,7 +246,7 @@ class Configuration {
|
||||||
|
|
||||||
static function getOGImage() {
|
static function getOGImage() {
|
||||||
global $global;
|
global $global;
|
||||||
$destination = "{$global['systemRootPath']}videos/cache/og_200X200.jpg";
|
$destination = Video::getStoragePath()."cache/og_200X200.jpg";
|
||||||
$return = self::_getFavicon(true);
|
$return = self::_getFavicon(true);
|
||||||
convertImageToOG($return['file'], $destination);
|
convertImageToOG($return['file'], $destination);
|
||||||
return $global['webSiteRootURL'] . "videos/cache/og_200X200.jpg";
|
return $global['webSiteRootURL'] . "videos/cache/og_200X200.jpg";
|
||||||
|
|
|
@ -1154,8 +1154,8 @@ function getVideosURL_V2($fileName, $recreateCache = false) {
|
||||||
return $getVideosURL_V2Array[$cleanfilename];
|
return $getVideosURL_V2Array[$cleanfilename];
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf = "{$global['systemRootPath']}videos/{$cleanfilename}.pdf";
|
$pdf = Video::getStoragePath()."{$cleanfilename}.pdf";
|
||||||
$mp3 = "{$global['systemRootPath']}videos/{$cleanfilename}.mp3";
|
$mp3 = Video::getStoragePath()."{$cleanfilename}.mp3";
|
||||||
if (file_exists($pdf)) {
|
if (file_exists($pdf)) {
|
||||||
return getVideosURLPDF($fileName);
|
return getVideosURLPDF($fileName);
|
||||||
} elseif (file_exists($mp3)) {
|
} elseif (file_exists($mp3)) {
|
||||||
|
@ -1204,7 +1204,7 @@ function getVideosURL_V2($fileName, $recreateCache = false) {
|
||||||
|
|
||||||
$formats = array_merge($video, $audio, $image);
|
$formats = array_merge($video, $audio, $image);
|
||||||
|
|
||||||
//$globQuery = "{$global['systemRootPath']}videos/{$cleanfilename}*.{" . implode(",", $formats) . "}";
|
//$globQuery = Video::getStoragePath()."{$cleanfilename}*.{" . implode(",", $formats) . "}";
|
||||||
//$filesInDir = glob($globQuery, GLOB_BRACE);
|
//$filesInDir = glob($globQuery, GLOB_BRACE);
|
||||||
$filesInDir = globVideosDir($cleanfilename, true);
|
$filesInDir = globVideosDir($cleanfilename, true);
|
||||||
foreach ($filesInDir as $file) {
|
foreach ($filesInDir as $file) {
|
||||||
|
@ -1613,12 +1613,12 @@ function decideMoveUploadedToVideos($tmp_name, $filename, $type = "video") {
|
||||||
$aws_s3 = AVideoPlugin::loadPluginIfEnabled('AWS_S3');
|
$aws_s3 = AVideoPlugin::loadPluginIfEnabled('AWS_S3');
|
||||||
$bb_b2 = AVideoPlugin::loadPluginIfEnabled('Blackblaze_B2');
|
$bb_b2 = AVideoPlugin::loadPluginIfEnabled('Blackblaze_B2');
|
||||||
$ftp = AVideoPlugin::loadPluginIfEnabled('FTP_Storage');
|
$ftp = AVideoPlugin::loadPluginIfEnabled('FTP_Storage');
|
||||||
$destinationFile = "{$global['systemRootPath']}videos/{$filename}";
|
$destinationFile = Video::getStoragePath()."{$filename}";
|
||||||
_error_log("decideMoveUploadedToVideos: {$filename}");
|
_error_log("decideMoveUploadedToVideos: {$filename}");
|
||||||
$path_info = pathinfo($filename);
|
$path_info = pathinfo($filename);
|
||||||
if ($type !== "zip" && $path_info['extension'] === 'zip') {
|
if ($type !== "zip" && $path_info['extension'] === 'zip') {
|
||||||
_error_log("decideMoveUploadedToVideos: ZIp file {$filename}");
|
_error_log("decideMoveUploadedToVideos: ZIp file {$filename}");
|
||||||
$dir = "{$global['systemRootPath']}videos/{$path_info['filename']}";
|
$dir = Video::getStoragePath()."{$path_info['filename']}";
|
||||||
unzipDirectory($tmp_name, $dir); // unzip it
|
unzipDirectory($tmp_name, $dir); // unzip it
|
||||||
cleanDirectory($dir);
|
cleanDirectory($dir);
|
||||||
if (!empty($aws_s3)) {
|
if (!empty($aws_s3)) {
|
||||||
|
@ -1748,8 +1748,8 @@ function decideFile_put_contentsToVideos($tmp_name, $filename) {
|
||||||
} elseif (!empty($ftp)) {
|
} elseif (!empty($ftp)) {
|
||||||
$ftp->move_uploaded_file($tmp_name, $filename);
|
$ftp->move_uploaded_file($tmp_name, $filename);
|
||||||
} else {
|
} else {
|
||||||
if (!move_uploaded_file($tmp_name, "{$global['systemRootPath']}videos/{$filename}")) {
|
if (!move_uploaded_file($tmp_name, Video::getStoragePath()."{$filename}")) {
|
||||||
$obj->msg = "Error on move_uploaded_file({$tmp_name}, {$global['systemRootPath']}videos/{$filename})";
|
$obj->msg = "Error on move_uploaded_file({$tmp_name}, {$filename})";
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2669,7 +2669,7 @@ function allowOrigin() {
|
||||||
|
|
||||||
function rrmdir($dir) {
|
function rrmdir($dir) {
|
||||||
global $global;
|
global $global;
|
||||||
if ($dir == "{$global['systemRootPath']}videos/" || $dir == "{$global['systemRootPath']}videos") {
|
if ($dir == Video::getStoragePath()."" || $dir == "{$global['systemRootPath']}videos") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
|
@ -3350,7 +3350,7 @@ function getCacheDir() {
|
||||||
|
|
||||||
function clearCache() {
|
function clearCache() {
|
||||||
global $global;
|
global $global;
|
||||||
$dir = "{$global['systemRootPath']}videos/cache/";
|
$dir = Video::getStoragePath()."cache/";
|
||||||
if (!empty($_GET['FirstPage'])) {
|
if (!empty($_GET['FirstPage'])) {
|
||||||
$dir .= "firstPage/";
|
$dir .= "firstPage/";
|
||||||
}
|
}
|
||||||
|
@ -3371,7 +3371,7 @@ function getUsageFromFilename($filename, $dir = "") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($dir)) {
|
if (empty($dir)) {
|
||||||
$dir = "{$global['systemRootPath']}videos/";
|
$dir = Video::getStoragePath()."";
|
||||||
}
|
}
|
||||||
$pos = strrpos($dir, '/');
|
$pos = strrpos($dir, '/');
|
||||||
$dir .= (($pos === false) ? "/" : "");
|
$dir .= (($pos === false) ? "/" : "");
|
||||||
|
@ -3578,7 +3578,7 @@ function foldersize($path) {
|
||||||
|
|
||||||
function getDiskUsage() {
|
function getDiskUsage() {
|
||||||
global $global;
|
global $global;
|
||||||
$dir = "{$global['systemRootPath']}videos/";
|
$dir = Video::getStoragePath()."";
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
$obj->disk_free_space = disk_free_space($dir);
|
$obj->disk_free_space = disk_free_space($dir);
|
||||||
$obj->disk_total_space = disk_total_space($dir);
|
$obj->disk_total_space = disk_total_space($dir);
|
||||||
|
@ -3806,7 +3806,7 @@ function isHLS() {
|
||||||
global $video, $global;
|
global $video, $global;
|
||||||
if (isLive()) {
|
if (isLive()) {
|
||||||
return true;
|
return true;
|
||||||
} elseif (!empty($video) && $video['type'] == 'video' && file_exists("{$global['systemRootPath']}videos/{$video['filename']}/index.m3u8")) {
|
} elseif (!empty($video) && $video['type'] == 'video' && file_exists(Video::getStoragePath()."{$video['filename']}/index.m3u8")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -4191,7 +4191,7 @@ function getTmpDir($subdir = "") {
|
||||||
if (empty($_SESSION['getTmpDir'][$subdir . "_"])) {
|
if (empty($_SESSION['getTmpDir'][$subdir . "_"])) {
|
||||||
$tmpDir = sys_get_temp_dir();
|
$tmpDir = sys_get_temp_dir();
|
||||||
if (empty($tmpDir) || !_isWritable($tmpDir)) {
|
if (empty($tmpDir) || !_isWritable($tmpDir)) {
|
||||||
$tmpDir = "{$global['systemRootPath']}videos/cache/";
|
$tmpDir = Video::getStoragePath()."cache/";
|
||||||
}
|
}
|
||||||
$tmpDir = rtrim($tmpDir, '/') . '/';
|
$tmpDir = rtrim($tmpDir, '/') . '/';
|
||||||
$tmpDir = "{$tmpDir}{$subdir}";
|
$tmpDir = "{$tmpDir}{$subdir}";
|
||||||
|
@ -4901,7 +4901,7 @@ function globVideosDir($filename, $filesOnly = false) {
|
||||||
$pattern .= ".(" . implode("|", $formats) . ")";
|
$pattern .= ".(" . implode("|", $formats) . ")";
|
||||||
}
|
}
|
||||||
$pattern .= "/";
|
$pattern .= "/";
|
||||||
return _glob("{$global['systemRootPath']}videos/", $pattern);
|
return _glob(Video::getStoragePath()."", $pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getValidFormats() {
|
function getValidFormats() {
|
||||||
|
@ -4966,7 +4966,7 @@ function downloadHLS($filepath) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$videosDir = "{$global['systemRootPath']}videos/";
|
$videosDir = Video::getStoragePath()."";
|
||||||
|
|
||||||
$outputfilename = str_replace($videosDir, "", $filepath);
|
$outputfilename = str_replace($videosDir, "", $filepath);
|
||||||
$parts = explode("/", $outputfilename);
|
$parts = explode("/", $outputfilename);
|
||||||
|
@ -5181,7 +5181,7 @@ function pathToRemoteURL($filename) {
|
||||||
|
|
||||||
function getFilenameFromPath($path) {
|
function getFilenameFromPath($path) {
|
||||||
global $global;
|
global $global;
|
||||||
$fileName = str_replace("{$global['systemRootPath']}videos/", "", $path);
|
$fileName = str_replace(Video::getStoragePath()."", "", $path);
|
||||||
$fileName = Video::getCleanFilenameFromFile($fileName);
|
$fileName = Video::getCleanFilenameFromFile($fileName);
|
||||||
|
|
||||||
return $fileName;
|
return $fileName;
|
||||||
|
|
|
@ -28,7 +28,7 @@ if (isset($_FILES['file_data']) && $_FILES['file_data']['error'] == 0) {
|
||||||
//var_dump($extension, $type);exit;
|
//var_dump($extension, $type);exit;
|
||||||
$video = new Video("", "", $_GET['video_id']);
|
$video = new Video("", "", $_GET['video_id']);
|
||||||
if (!empty($video)) {
|
if (!empty($video)) {
|
||||||
$dir = "{$global['systemRootPath']}videos/articleImages/" . $video->getFilename()."/";
|
$dir = Video::getStoragePath()."articleImages/" . $video->getFilename()."/";
|
||||||
$name = uniqid();
|
$name = uniqid();
|
||||||
if(!is_dir($dir)){
|
if(!is_dir($dir)){
|
||||||
mkdir($dir, 0777, true);
|
mkdir($dir, 0777, true);
|
||||||
|
|
|
@ -26,12 +26,12 @@ if (isset($_FILES['file_data']) && $_FILES['file_data']['error'] == 0) {
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpDestination = "{$global['systemRootPath']}videos/userPhoto/tmp_background".User::getId().".". $extension;
|
$tmpDestination = Video::getStoragePath()."userPhoto/tmp_background".User::getId().".". $extension;
|
||||||
$obj->file = "videos/userPhoto/background".User::getId().".jpg";
|
$obj->file = "videos/userPhoto/background".User::getId().".jpg";
|
||||||
$oldfile = "{$global['systemRootPath']}videos/userPhoto/background".User::getId().".png";
|
$oldfile = Video::getStoragePath()."userPhoto/background".User::getId().".png";
|
||||||
|
|
||||||
if (!move_uploaded_file($_FILES['file_data']['tmp_name'], $tmpDestination)) {
|
if (!move_uploaded_file($_FILES['file_data']['tmp_name'], $tmpDestination)) {
|
||||||
$obj->msg = "Error on move_file_uploaded_file(" . $_FILES['file_data']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/" . $filename . $ext;
|
$obj->msg = "Error on move_file_uploaded_file(" . $_FILES['file_data']['tmp_name'] . ", " . Video::getStoragePath()."" . $filename . $ext;
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
}
|
}
|
||||||
convertImage($tmpDestination, $global['systemRootPath'].$obj->file, 70);
|
convertImage($tmpDestination, $global['systemRootPath'].$obj->file, 70);
|
||||||
|
|
|
@ -57,10 +57,10 @@ if (isset($_FILES['file_data']) && $_FILES['file_data']['error'] == 0) {
|
||||||
/**
|
/**
|
||||||
* This is when is using in a non file_dataoaded movie
|
* This is when is using in a non file_dataoaded movie
|
||||||
*/
|
*/
|
||||||
$destination = "{$global['systemRootPath']}videos/" . $video->getFilename() . $ext;
|
$destination = Video::getStoragePath()."" . $video->getFilename() . $ext;
|
||||||
_error_log("Try to move " . $destination . " \n " . print_r($video, true));
|
_error_log("Try to move " . $destination . " \n " . print_r($video, true));
|
||||||
if (!move_uploaded_file($_FILES['file_data']['tmp_name'], $destination)) {
|
if (!move_uploaded_file($_FILES['file_data']['tmp_name'], $destination)) {
|
||||||
$obj->msg = "Error on move_file_uploaded_file(" . $_FILES['file_data']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/" . $filename . $ext;
|
$obj->msg = "Error on move_file_uploaded_file(" . $_FILES['file_data']['tmp_name'] . ", " . Video::getStoragePath()."" . $filename . $ext;
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
} else {
|
} else {
|
||||||
// delete thumbs from poster
|
// delete thumbs from poster
|
||||||
|
|
|
@ -1623,7 +1623,7 @@ if (!class_exists('Video')) {
|
||||||
$object = new stdClass();
|
$object = new stdClass();
|
||||||
|
|
||||||
foreach (self::$types as $value) {
|
foreach (self::$types as $value) {
|
||||||
$progressFilename = "{$global['systemRootPath']}videos/{$filename}_progress_{$value}.txt";
|
$progressFilename = self::getStoragePathFromFileName($filename). "progress_{$value}.txt";
|
||||||
$content = @url_get_contents($progressFilename);
|
$content = @url_get_contents($progressFilename);
|
||||||
$object->$value = new stdClass();
|
$object->$value = new stdClass();
|
||||||
if (!empty($content)) {
|
if (!empty($content)) {
|
||||||
|
@ -1804,10 +1804,10 @@ if (!class_exists('Video')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
global $global;
|
global $global;
|
||||||
$file = "{$global['systemRootPath']}videos/original_{$filename}";
|
$file = self::getStoragePath()."original_{$filename}";
|
||||||
$this->removeFilePath($file);
|
$this->removeFilePath($file);
|
||||||
|
|
||||||
$files = "{$global['systemRootPath']}videos/{$filename}";
|
$files = self::getStoragePath()."{$filename}";
|
||||||
$this->removeFilePath($files);
|
$this->removeFilePath($files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2790,7 +2790,7 @@ if (!class_exists('Video')) {
|
||||||
|
|
||||||
// check if there is a webp image
|
// check if there is a webp image
|
||||||
if ($type === '.gif' && (empty($_SERVER['HTTP_USER_AGENT']) || get_browser_name($_SERVER['HTTP_USER_AGENT']) !== 'Safari')) {
|
if ($type === '.gif' && (empty($_SERVER['HTTP_USER_AGENT']) || get_browser_name($_SERVER['HTTP_USER_AGENT']) !== 'Safari')) {
|
||||||
$path = "{$global['systemRootPath']}videos/{$filename}.webp";
|
$path = self::getStoragePath()."{$filename}.webp";
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
$type = ".webp";
|
$type = ".webp";
|
||||||
}
|
}
|
||||||
|
@ -2824,10 +2824,10 @@ if (!class_exists('Video')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$source = array();
|
$source = array();
|
||||||
$source['path'] = "{$global['systemRootPath']}videos/{$filename}{$type}";
|
$source['path'] = self::getStoragePath()."{$filename}{$type}";
|
||||||
|
|
||||||
if ($type == ".m3u8") {
|
if ($type == ".m3u8") {
|
||||||
$source['path'] = "{$global['systemRootPath']}videos/{$filename}/index{$type}";
|
$source['path'] = self::getStoragePath()."{$filename}/index{$type}";
|
||||||
}
|
}
|
||||||
$cleanFileName = self::getCleanFilenameFromFile($filename);
|
$cleanFileName = self::getCleanFilenameFromFile($filename);
|
||||||
$video = Video::getVideoFromFileNameLight($cleanFileName);
|
$video = Video::getVideoFromFileNameLight($cleanFileName);
|
||||||
|
@ -3135,13 +3135,24 @@ if (!class_exists('Video')) {
|
||||||
return $videos;
|
return $videos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getStoragePath()
|
public static function getStoragePath(){
|
||||||
{
|
|
||||||
global $global;
|
global $global;
|
||||||
$path = "{$global['systemRootPath']}videos/";
|
$path = "{$global['systemRootPath']}videos/";
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getStoragePathFromFileName($filename){
|
||||||
|
$cleanFileName = self::getCleanFilenameFromFile($filename);
|
||||||
|
$path = self::getStoragePath()."{$cleanFileName}/";
|
||||||
|
make_path($path);
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getStoragePathFromVideosId($videos_id){
|
||||||
|
$v = new Video("", "", $videos_id);
|
||||||
|
return self::getStoragePathFromFileName($v->getFilename());
|
||||||
|
}
|
||||||
|
|
||||||
public static function getImageFromFilename($filename, $type = "video", $async = false)
|
public static function getImageFromFilename($filename, $type = "video", $async = false)
|
||||||
{
|
{
|
||||||
global $advancedCustom;
|
global $advancedCustom;
|
||||||
|
@ -3628,7 +3639,7 @@ if (!class_exists('Video')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
global $global;
|
global $global;
|
||||||
$filePath = "{$global['systemRootPath']}videos/{$filename}";
|
$filePath = Video::getStoragePath()."{$filename}";
|
||||||
// Streamlined for less coding space.
|
// Streamlined for less coding space.
|
||||||
$files = glob("{$filePath}*_thumbs*.jpg");
|
$files = glob("{$filePath}*_thumbs*.jpg");
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ class CloneLog{
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
global $global;
|
global $global;
|
||||||
$clonesDir = "{$global['systemRootPath']}videos/cache/clones/";
|
$clonesDir = Video::getStoragePath()."cache/clones/";
|
||||||
$this->file = "{$clonesDir}client.log";
|
$this->file = "{$clonesDir}client.log";
|
||||||
if (!file_exists($clonesDir)) {
|
if (!file_exists($clonesDir)) {
|
||||||
mkdir($clonesDir, 0777, true);
|
mkdir($clonesDir, 0777, true);
|
||||||
|
|
|
@ -55,7 +55,7 @@ if (empty($objClone) || empty($argv[1]) || $objClone->myKey !== $argv[1]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$videosSite = "{$objClone->cloneSiteURL}videos/";
|
$videosSite = "{$objClone->cloneSiteURL}videos/";
|
||||||
$videosDir = "{$global['systemRootPath']}videos/";
|
$videosDir = Video::getStoragePath()."";
|
||||||
$clonesDir = "{$videosDir}cache/clones/";
|
$clonesDir = "{$videosDir}cache/clones/";
|
||||||
$photosDir = "{$videosDir}userPhoto/";
|
$photosDir = "{$videosDir}userPhoto/";
|
||||||
$photosSite = "{$videosSite}userPhoto/";
|
$photosSite = "{$videosSite}userPhoto/";
|
||||||
|
@ -163,7 +163,7 @@ if (empty($objClone->useRsync)) {
|
||||||
if(empty($port)){
|
if(empty($port)){
|
||||||
$port = 22;
|
$port = 22;
|
||||||
}
|
}
|
||||||
$rsync = "sshpass -p '{password}' rsync -av -e 'ssh -p {$port} -o StrictHostKeyChecking=no' --exclude '*.php' --exclude 'cache' --exclude '*.sql' --exclude '*.log' {$objClone->cloneSiteSSHUser}@{$objClone->cloneSiteSSHIP}:{$json->videosDir} {$global['systemRootPath']}videos/ --log-file='{$log->file}' ";
|
$rsync = "sshpass -p '{password}' rsync -av -e 'ssh -p {$port} -o StrictHostKeyChecking=no' --exclude '*.php' --exclude 'cache' --exclude '*.sql' --exclude '*.log' {$objClone->cloneSiteSSHUser}@{$objClone->cloneSiteSSHIP}:{$json->videosDir} Video::getStoragePath()." --log-file='{$log->file}' ";
|
||||||
$cmd = str_replace("{password}", $objClone->cloneSiteSSHPassword->value, $rsync);
|
$cmd = str_replace("{password}", $objClone->cloneSiteSSHPassword->value, $rsync);
|
||||||
$log->add("Clone (4 of {$totalSteps}): execute rsync ({$rsync})");
|
$log->add("Clone (4 of {$totalSteps}): execute rsync ({$rsync})");
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ require_once $global['systemRootPath'] . 'plugin/CloneSite/Objects/Clones.php';
|
||||||
require_once $global['systemRootPath'] . 'plugin/CloneSite/functions.php';
|
require_once $global['systemRootPath'] . 'plugin/CloneSite/functions.php';
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
$videosDir = "{$global['systemRootPath']}videos/";
|
$videosDir = Video::getStoragePath()."";
|
||||||
$clonesDir = "{$videosDir}cache/clones/";
|
$clonesDir = "{$videosDir}cache/clones/";
|
||||||
$photosDir = "{$videosDir}userPhoto/";
|
$photosDir = "{$videosDir}userPhoto/";
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ $resp->msg = "";
|
||||||
$resp->url = $_GET['url'];
|
$resp->url = $_GET['url'];
|
||||||
$resp->key = $_GET['key'];
|
$resp->key = $_GET['key'];
|
||||||
$resp->useRsync = intval($_GET['useRsync']);
|
$resp->useRsync = intval($_GET['useRsync']);
|
||||||
$resp->videosDir = "{$global['systemRootPath']}videos/";
|
$resp->videosDir = Video::getStoragePath()."";
|
||||||
$resp->sqlFile = "";
|
$resp->sqlFile = "";
|
||||||
$resp->videoFiles = array();
|
$resp->videoFiles = array();
|
||||||
$resp->photoFiles = array();
|
$resp->photoFiles = array();
|
||||||
|
|
|
@ -26,7 +26,7 @@ if ($oIMDB->isReady) {
|
||||||
if (empty($_GET['what']) || $_GET['what'] == 1) {
|
if (empty($_GET['what']) || $_GET['what'] == 1) {
|
||||||
// get poster
|
// get poster
|
||||||
$poster = $oIMDB->getPoster('big', true);
|
$poster = $oIMDB->getPoster('big', true);
|
||||||
$filename = "{$global['systemRootPath']}videos/{$videoFileName}_portrait.jpg";
|
$filename = Video::getStoragePath()."{$videoFileName}_portrait.jpg";
|
||||||
im_resizeV2($poster, $filename, $plugin->posterWidth, $plugin->posterHeight);
|
im_resizeV2($poster, $filename, $plugin->posterWidth, $plugin->posterHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class Layout extends PluginAbstract {
|
||||||
public function getStart() {
|
public function getStart() {
|
||||||
global $global;
|
global $global;
|
||||||
return "";
|
return "";
|
||||||
$filename = "{$global['systemRootPath']}videos/cache/custom.css";
|
$filename = Video::getStoragePath()."cache/custom.css";
|
||||||
if (!file_exists($filename)) {
|
if (!file_exists($filename)) {
|
||||||
include $global['systemRootPath'] . 'plugin/Customize/sass/compile.php';
|
include $global['systemRootPath'] . 'plugin/Customize/sass/compile.php';
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,8 +91,8 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
|
|
||||||
$video->setStatus('e');
|
$video->setStatus('e');
|
||||||
|
|
||||||
if (!move_uploaded_file($_FILES['upl']['tmp_name'], "{$global['systemRootPath']}videos/original_" . $filename)) {
|
if (!move_uploaded_file($_FILES['upl']['tmp_name'], Video::getStoragePath()."original_" . $filename)) {
|
||||||
$object->msg = "Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/original_" . $filename . ")";
|
$object->msg = "Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . Video::getStoragePath()."original_" . $filename . ")";
|
||||||
_error_log("MOBILE UPLOAD ERROR: ". json_encode($object));
|
_error_log("MOBILE UPLOAD ERROR: ". json_encode($object));
|
||||||
die(json_encode($object));
|
die(json_encode($object));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ if (empty($_GET['videoDirectory'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$video = Video::getVideoFromFileName($_GET['videoDirectory'], true);
|
$video = Video::getVideoFromFileName($_GET['videoDirectory'], true);
|
||||||
$filename = "{$global['systemRootPath']}videos/{$_GET['videoDirectory']}/index.m3u8";
|
$filename = Video::getStoragePath()."{$_GET['videoDirectory']}/index.m3u8";
|
||||||
$_GET['file'] = "{$global['systemRootPath']}videos/{$_GET['videoDirectory']}/index.m3u8";
|
$_GET['file'] = Video::getStoragePath()."{$_GET['videoDirectory']}/index.m3u8";
|
||||||
//var_dump($_GET['file']);exit;
|
//var_dump($_GET['file']);exit;
|
||||||
$cachedPath = explode("/", $_GET['videoDirectory']);
|
$cachedPath = explode("/", $_GET['videoDirectory']);
|
||||||
if (empty($_SESSION['user']['sessionCache']['hls'][$cachedPath[0]]) && empty($_GET['download'])) {
|
if (empty($_SESSION['user']['sessionCache']['hls'][$cachedPath[0]]) && empty($_GET['download'])) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ if(!empty($_GET['image'])){
|
||||||
}
|
}
|
||||||
// if the thumb is not ready yet, try to find the default image
|
// if the thumb is not ready yet, try to find the default image
|
||||||
if(preg_match('/videos\/(.*)_thumbs(V2)?.jpg/',$imageURL, $matches)){
|
if(preg_match('/videos\/(.*)_thumbs(V2)?.jpg/',$imageURL, $matches)){
|
||||||
$jpg = "{$global['systemRootPath']}videos/{$matches[1]}.jpg";
|
$jpg = Video::getStoragePath()."{$matches[1]}.jpg";
|
||||||
if(file_exists($jpg)){
|
if(file_exists($jpg)){
|
||||||
$file = $jpg;
|
$file = $jpg;
|
||||||
$type = 'image/jpg';
|
$type = 'image/jpg';
|
||||||
|
|
|
@ -82,7 +82,7 @@ $cssURL = combineFiles($cssFiles, "css");
|
||||||
?>
|
?>
|
||||||
<link href="<?php echo $cssURL; ?>" rel="stylesheet" type="text/css"/>
|
<link href="<?php echo $cssURL; ?>" rel="stylesheet" type="text/css"/>
|
||||||
<?php
|
<?php
|
||||||
$filename = "{$global['systemRootPath']}videos/cache/custom.css";
|
$filename = Video::getStoragePath()."cache/custom.css";
|
||||||
if($theme === "default" && !empty($customizePlugin->showCustomCSS) && file_exists($filename)){
|
if($theme === "default" && !empty($customizePlugin->showCustomCSS) && file_exists($filename)){
|
||||||
echo '<link href="'.$global['webSiteRootURL'].'videos/cache/custom.css?'. filectime($filename) .'" rel="stylesheet" type="text/css" id="pluginCustomCss" />';
|
echo '<link href="'.$global['webSiteRootURL'].'videos/cache/custom.css?'. filectime($filename) .'" rel="stylesheet" type="text/css" id="pluginCustomCss" />';
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -151,7 +151,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
|
|
||||||
if($extension !== "jpg" && $video->getType() == "image"){
|
if($extension !== "jpg" && $video->getType() == "image"){
|
||||||
sleep(1);// to make sure the file will be available
|
sleep(1);// to make sure the file will be available
|
||||||
$file = "{$global['systemRootPath']}videos/". $video->getFilename();
|
$file = Video::getStoragePath()."". $video->getFilename();
|
||||||
try {
|
try {
|
||||||
convertImage("{$file}.{$extension}", "{$file}.jpg", 70);
|
convertImage("{$file}.{$extension}", "{$file}.jpg", 70);
|
||||||
} catch (Exception $exc) {
|
} catch (Exception $exc) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ if (!empty($playlist_id)) {
|
||||||
<div class="col-lg-5 col-sm-5 col-xs-5 nopadding thumbsImage">
|
<div class="col-lg-5 col-sm-5 col-xs-5 nopadding thumbsImage">
|
||||||
<?php
|
<?php
|
||||||
$imgGif = "";
|
$imgGif = "";
|
||||||
if (file_exists("{$global['systemRootPath']}videos/{$autoPlayVideo['filename']}.gif")) {
|
if (file_exists(Video::getStoragePath()."{$autoPlayVideo['filename']}.gif")) {
|
||||||
$imgGif = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.gif";
|
$imgGif = "{$global['webSiteRootURL']}videos/{$autoPlayVideo['filename']}.gif";
|
||||||
}
|
}
|
||||||
if ($autoPlayVideo['type'] === "pdf") {
|
if ($autoPlayVideo['type'] === "pdf") {
|
||||||
|
|
|
@ -15,7 +15,7 @@ if (!User::isAdmin()) {
|
||||||
}
|
}
|
||||||
// remove cache dir before the script starts to let the script recreate the javascript and css files
|
// remove cache dir before the script starts to let the script recreate the javascript and css files
|
||||||
if (!empty($_POST['updateFile'])) {
|
if (!empty($_POST['updateFile'])) {
|
||||||
$dir = "{$global['systemRootPath']}videos/cache";
|
$dir = Video::getStoragePath()."cache";
|
||||||
rrmdir($dir);
|
rrmdir($dir);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -124,7 +124,7 @@ if (!empty($_POST['updateFile'])) {
|
||||||
} else {
|
} else {
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
$templine = '';
|
$templine = '';
|
||||||
$logfile = "{$global['systemRootPath']}videos/avideo.";
|
$logfile = Video::getStoragePath()."avideo.";
|
||||||
if (file_exists($logfile . "log")) {
|
if (file_exists($logfile . "log")) {
|
||||||
unlink($logfile . "log");
|
unlink($logfile . "log");
|
||||||
_error_log("avideo.log deleted by update");
|
_error_log("avideo.log deleted by update");
|
||||||
|
|
|
@ -378,7 +378,7 @@ if (User::hasBlockedUser($video['users_id'])) {
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
} else if ($video['type'] == "audio" && !file_exists("{$global['systemRootPath']}videos/{$video['filename']}.mp4")) {
|
} else if ($video['type'] == "audio" && !file_exists(Video::getStoragePath()."{$video['filename']}.mp4")) {
|
||||||
$isAudio = 1;
|
$isAudio = 1;
|
||||||
?>
|
?>
|
||||||
<audio style="width: 100%; height: 100%;" id="mainVideo" <?php echo $controls; ?> <?php echo $loop; ?> class="center-block video-js vjs-default-skin vjs-big-play-centered" id="mainVideo" data-setup='{ "fluid": true }'
|
<audio style="width: 100%; height: 100%;" id="mainVideo" <?php echo $controls; ?> <?php echo $loop; ?> class="center-block video-js vjs-default-skin vjs-big-play-centered" id="mainVideo" data-setup='{ "fluid": true }'
|
||||||
|
|
|
@ -16,7 +16,7 @@ if (empty($_GET['file'])) {
|
||||||
|
|
||||||
$path_parts = pathinfo($_GET['file']);
|
$path_parts = pathinfo($_GET['file']);
|
||||||
$file = $path_parts['basename'];
|
$file = $path_parts['basename'];
|
||||||
$path = "{$global['systemRootPath']}videos/{$file}";
|
$path = Video::getStoragePath()."{$file}";
|
||||||
|
|
||||||
if ($file == "X-Sendfile.mp4") {
|
if ($file == "X-Sendfile.mp4") {
|
||||||
$path = "{$global['systemRootPath']}plugin/SecureVideosDirectory/test.json";
|
$path = "{$global['systemRootPath']}plugin/SecureVideosDirectory/test.json";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue