mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
Refactor Video Status Constants
- Updated references from Video::$status* to Video::STATUS_* for consistency across multiple files. - Ensured that all instances of video status checks and assignments utilize the new constant format. - This change improves code readability and maintainability by standardizing the way video statuses are referenced throughout the codebase.
This commit is contained in:
parent
0c05672df9
commit
8db8d44a92
32 changed files with 442 additions and 401 deletions
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
//streamer config
|
//streamer config
|
||||||
require_once '../videos/configuration.php';
|
require_once '../videos/configuration.php';
|
||||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||||
|
|
||||||
if (!isCommandLineInterface()) {
|
if (!isCommandLineInterface()) {
|
||||||
return die('Command Line only');
|
return die('Command Line only');
|
||||||
}
|
}
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
$sql = "UPDATE videos SET status = ? WHERE status = ? ";
|
$sql = "UPDATE videos SET status = ? WHERE status = ? ";
|
||||||
sqlDAL::writeSql($sql, 'ss', array(Video::$statusUnlistedButSearchable, Video::$statusUnlisted));
|
sqlDAL::writeSql($sql, 'ss', array(Video::STATUS_UNLISTED_BUT_SEARCHABLE, Video::STATUS_UNLISTED));
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
<?php
|
<?php
|
||||||
//streamer config
|
//streamer config
|
||||||
require_once '../videos/configuration.php';
|
require_once '../videos/configuration.php';
|
||||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||||
|
|
||||||
if (!isCommandLineInterface()) {
|
if (!isCommandLineInterface()) {
|
||||||
return die('Command Line only');
|
return die('Command Line only');
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayStatusToDelete = array(
|
$arrayStatusToDelete = array(
|
||||||
Video::$statusBrokenMissingFiles,
|
Video::STATUS_BROKEN_MISSING_FILES,
|
||||||
Video::$statusDownloading,
|
Video::STATUS_DOWNLOADING,
|
||||||
Video::$statusEncoding,
|
Video::STATUS_ENCODING,
|
||||||
Video::$statusEncodingError,
|
Video::STATUS_ENCODING_ERROR,
|
||||||
Video::$statusTranfering,
|
Video::STATUS_TRANFERING,
|
||||||
);
|
);
|
||||||
|
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
$sql = "SELECT * FROM videos where status in ('".implode("', '", $arrayStatusToDelete)."') ";
|
$sql = "SELECT * FROM videos where status in ('".implode("', '", $arrayStatusToDelete)."') ";
|
||||||
$res = sqlDAL::readSql($sql);
|
$res = sqlDAL::readSql($sql);
|
||||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||||
$total = count($fullData);
|
$total = count($fullData);
|
||||||
sqlDAL::close($res);
|
sqlDAL::close($res);
|
||||||
$rows = [];
|
$rows = [];
|
||||||
if ($res != false) {
|
if ($res != false) {
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($fullData as $key => $row) {
|
foreach ($fullData as $key => $row) {
|
||||||
$count++;
|
$count++;
|
||||||
if(!in_array($row['status'], $arrayStatusToDelete)){
|
if(!in_array($row['status'], $arrayStatusToDelete)){
|
||||||
echo "{$total}/{$count} Deleteuseless skip status={$row['status']} title={$row['title']}".PHP_EOL;
|
echo "{$total}/{$count} Deleteuseless skip status={$row['status']} title={$row['title']}".PHP_EOL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$v = new Video('', '', $row['id']);
|
$v = new Video('', '', $row['id']);
|
||||||
if ($v->delete(true)) {
|
if ($v->delete(true)) {
|
||||||
echo "{$total}/{$count} Deleteuseless deleted from status={$row['status']} title={$row['title']}".PHP_EOL;
|
echo "{$total}/{$count} Deleteuseless deleted from status={$row['status']} title={$row['title']}".PHP_EOL;
|
||||||
} else {
|
} else {
|
||||||
echo "{$total}/{$count} Deleteuseless ERROR status={$row['status']} title={$row['title']}".PHP_EOL;
|
echo "{$total}/{$count} Deleteuseless ERROR status={$row['status']} title={$row['title']}".PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,8 +93,8 @@ $channelName = $info['channelName'];
|
||||||
$channelURL = $info['channelURL'];
|
$channelURL = $info['channelURL'];
|
||||||
|
|
||||||
echo ("importChannel: start {$siteURL} {$channelName}").PHP_EOL;
|
echo ("importChannel: start {$siteURL} {$channelName}").PHP_EOL;
|
||||||
|
|
||||||
|
|
||||||
$users_id = 0;
|
$users_id = 0;
|
||||||
while (empty($users_id)) {
|
while (empty($users_id)) {
|
||||||
$_GET['searchPhrase'] = '';
|
$_GET['searchPhrase'] = '';
|
||||||
|
@ -161,7 +161,7 @@ while ($hasNewContent && !empty($users_id)) {
|
||||||
$video->setUsers_id($users_id);
|
$video->setUsers_id($users_id);
|
||||||
$video->setRrating($value->rrating);
|
$video->setRrating($value->rrating);
|
||||||
$video->setExternalOptions($value->externalOptions);
|
$video->setExternalOptions($value->externalOptions);
|
||||||
$video->setStatus(Video::$statusTranfering);
|
$video->setStatus(Video::STATUS_TRANFERING);
|
||||||
|
|
||||||
echo ("importChannel: Saving video").PHP_EOL;
|
echo ("importChannel: Saving video").PHP_EOL;
|
||||||
$id = $video->save(false, true);
|
$id = $video->save(false, true);
|
||||||
|
@ -184,10 +184,10 @@ while ($hasNewContent && !empty($users_id)) {
|
||||||
download($value->videos->mp3, $value->filename, $path);
|
download($value->videos->mp3, $value->filename, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$video->setStatus(Video::$statusActive);
|
$video->setStatus(Video::STATUS_ACTIVE);
|
||||||
} else {
|
} else {
|
||||||
echo ("importChannel: ERROR Video NOT saved").PHP_EOL;
|
echo ("importChannel: ERROR Video NOT saved").PHP_EOL;
|
||||||
$video->setStatus(Video::$statusBrokenMissingFiles);
|
$video->setStatus(Video::STATUS_BROKEN_MISSING_FILES);
|
||||||
}
|
}
|
||||||
$video->save(false, true);
|
$video->save(false, true);
|
||||||
//exit;
|
//exit;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* php importSiteFromAPI.php https://yoursiteURL.com/ APISecret [users_id] [categories_id]
|
* php importSiteFromAPI.php https://yoursiteURL.com/ APISecret [users_id] [categories_id]
|
||||||
* if does not pass users_id it will also import users
|
* if does not pass users_id it will also import users
|
||||||
* if does not pass categories id it will also import categories
|
* if does not pass categories id it will also import categories
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$siteURL = trim(@$argv[1]);
|
$siteURL = trim(@$argv[1]);
|
||||||
|
@ -205,7 +205,7 @@ if ($type !== 'm3u8') {
|
||||||
//wget($value->background, "{$global['systemRootPath']}videos/userPhoto/photo{$id}.png", true);
|
//wget($value->background, "{$global['systemRootPath']}videos/userPhoto/photo{$id}.png", true);
|
||||||
} else {
|
} else {
|
||||||
_error_log("importUsers: ERROR NOT saved");
|
_error_log("importUsers: ERROR NOT saved");
|
||||||
$video->setStatus(Video::$statusBrokenMissingFiles);
|
$video->setStatus(Video::STATUS_BROKEN_MISSING_FILES);
|
||||||
}
|
}
|
||||||
//exit;
|
//exit;
|
||||||
}
|
}
|
||||||
|
@ -289,22 +289,22 @@ while ($hasNewContent) {
|
||||||
$video->setDescription($value->description);
|
$video->setDescription($value->description);
|
||||||
$video->setUsers_id($users_id);
|
$video->setUsers_id($users_id);
|
||||||
$video->setCategories_id($categories_id);
|
$video->setCategories_id($categories_id);
|
||||||
|
|
||||||
$path = getVideosDir() . $value->filename . DIRECTORY_SEPARATOR;
|
$path = getVideosDir() . $value->filename . DIRECTORY_SEPARATOR;
|
||||||
$size = getDirSize($path);
|
$size = getDirSize($path);
|
||||||
if ($size < 10000000) {
|
if ($size < 10000000) {
|
||||||
if(empty($videos_id)){
|
if(empty($videos_id)){
|
||||||
$video->setStatus(Video::$statusTranfering);
|
$video->setStatus(Video::STATUS_TRANFERING);
|
||||||
_error_log("importVideo status: transfering ($size) " . humanFileSize($size));
|
_error_log("importVideo status: transfering ($size) " . humanFileSize($size));
|
||||||
}else{
|
}else{
|
||||||
if ($size > 1000000) {
|
if ($size > 1000000) {
|
||||||
$video->setStatus(Video::$statusActive);
|
$video->setStatus(Video::STATUS_ACTIVE);
|
||||||
}
|
}
|
||||||
_error_log("importVideo status: else ($size) " . humanFileSize($size));
|
_error_log("importVideo status: else ($size) " . humanFileSize($size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(empty($videos_id)){
|
if(empty($videos_id)){
|
||||||
$video->setStatus(Video::$statusTranfering);
|
$video->setStatus(Video::STATUS_TRANFERING);
|
||||||
}
|
}
|
||||||
|
|
||||||
_error_log("importVideo: Saving video");
|
_error_log("importVideo: Saving video");
|
||||||
|
@ -327,16 +327,16 @@ while ($hasNewContent) {
|
||||||
download($value->videos->mp3, $value->filename, $path);
|
download($value->videos->mp3, $value->filename, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$video->setStatus(Video::$statusActive);
|
$video->setStatus(Video::STATUS_ACTIVE);
|
||||||
if (!empty($value->videos->m3u8)) {
|
if (!empty($value->videos->m3u8)) {
|
||||||
if ($size < 10000000) {
|
if ($size < 10000000) {
|
||||||
if(empty($videos_id)){
|
if(empty($videos_id)){
|
||||||
_error_log("importVideo m3u8: {$value->videos->m3u8->url} APIURL = $APIURL ($size) " . humanFileSize($size));
|
_error_log("importVideo m3u8: {$value->videos->m3u8->url} APIURL = $APIURL ($size) " . humanFileSize($size));
|
||||||
sendToEncoder($id, $value->videos->m3u8->url);
|
sendToEncoder($id, $value->videos->m3u8->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($videos_id)){
|
if(empty($videos_id)){
|
||||||
$video->setStatus(Video::$statusEncoding);
|
$video->setStatus(Video::STATUS_ENCODING);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_error_log("importVideo m3u8 NOT SEND: ($size) " . humanFileSize($size));
|
_error_log("importVideo m3u8 NOT SEND: ($size) " . humanFileSize($size));
|
||||||
|
@ -354,7 +354,7 @@ while ($hasNewContent) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_error_log("importVideo: ERROR Video NOT saved");
|
_error_log("importVideo: ERROR Video NOT saved");
|
||||||
$video->setStatus(Video::$statusBrokenMissingFiles);
|
$video->setStatus(Video::STATUS_BROKEN_MISSING_FILES);
|
||||||
}
|
}
|
||||||
$video->save(false, true);
|
$video->save(false, true);
|
||||||
//exit;
|
//exit;
|
||||||
|
|
|
@ -131,7 +131,7 @@ for ($i = 0; $i < $totalVideos; $i++) {
|
||||||
$index = array_rand($cats);
|
$index = array_rand($cats);
|
||||||
|
|
||||||
$video->setCategories_id($cats[$index]['id']);
|
$video->setCategories_id($cats[$index]['id']);
|
||||||
$video->setStatus(Video::$statusActive);
|
$video->setStatus(Video::STATUS_ACTIVE);
|
||||||
$video->setFilesize(2858747);
|
$video->setFilesize(2858747);
|
||||||
$video->setLikes(rand(0, 1000));
|
$video->setLikes(rand(0, 1000));
|
||||||
$video->setDislikes(rand(0, 1000));
|
$video->setDislikes(rand(0, 1000));
|
||||||
|
@ -200,4 +200,4 @@ foreach ($pls as $key => $value) {
|
||||||
echo "[{$total}/{$key}/{$j}] pupulating done [$videos_id] Video added in a Playlist" . PHP_EOL;
|
echo "[{$total}/{$key}/{$j}] pupulating done [$videos_id] Video added in a Playlist" . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,7 +32,7 @@ foreach ($folders as $folder) {
|
||||||
if (is_dir($fullPath) && (str_starts_with($folder, 'v_') || str_starts_with($folder, 'video_'))) {
|
if (is_dir($fullPath) && (str_starts_with($folder, 'v_') || str_starts_with($folder, 'video_'))) {
|
||||||
$video = Video::getVideoFromFileNameLight($folder);
|
$video = Video::getVideoFromFileNameLight($folder);
|
||||||
if (!empty($video)) {
|
if (!empty($video)) {
|
||||||
if ($video['status'] === Video::$statusEncoding) {
|
if ($video['status'] === Video::STATUS_ENCODING) {
|
||||||
if (strtotime($video['created']) < strtotime('-2 days')) {
|
if (strtotime($video['created']) < strtotime('-2 days')) {
|
||||||
if (getDirSize($fullPath) > $_500MB) {
|
if (getDirSize($fullPath) > $_500MB) {
|
||||||
$v = new Video('', '', $video['id']);
|
$v = new Video('', '', $video['id']);
|
||||||
|
|
|
@ -61,7 +61,7 @@ if (!empty($confirm) && strtolower($confirm) === 'y') {
|
||||||
$count++;
|
$count++;
|
||||||
$title = "Video recovered: ".date("Y-m-d H:i:s", filectime($value[1]));
|
$title = "Video recovered: ".date("Y-m-d H:i:s", filectime($value[1]));
|
||||||
$video = new Video($title, $value[0]);
|
$video = new Video($title, $value[0]);
|
||||||
$video->setStatus(Video::$statusActive);
|
$video->setStatus(Video::STATUS_ACTIVE);
|
||||||
$video->setUsers_id(1);
|
$video->setUsers_id(1);
|
||||||
if ($video->save(false, true)) {
|
if ($video->save(false, true)) {
|
||||||
echo "{$count}/{$total} {$title} created\n";
|
echo "{$count}/{$total} {$title} created\n";
|
||||||
|
|
|
@ -52,7 +52,7 @@ foreach ($folders as $folder) {
|
||||||
$new_video->setCreated($mysqlDate);
|
$new_video->setCreated($mysqlDate);
|
||||||
$new_video->setCategories_id(1);
|
$new_video->setCategories_id(1);
|
||||||
$new_video->setUsers_id(1);
|
$new_video->setUsers_id(1);
|
||||||
$new_video->setStatus(Video::$statusActive);
|
$new_video->setStatus(Video::STATUS_ACTIVE);
|
||||||
$new_video->setType(Video::$videoTypeVideo);
|
$new_video->setType(Video::$videoTypeVideo);
|
||||||
|
|
||||||
$id = $new_video->save(false, true);
|
$id = $new_video->save(false, true);
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
<?php
|
<?php
|
||||||
//streamer config
|
//streamer config
|
||||||
require_once '../videos/configuration.php';
|
require_once '../videos/configuration.php';
|
||||||
|
|
||||||
if (!isCommandLineInterface()) {
|
if (!isCommandLineInterface()) {
|
||||||
return die('Command Line only');
|
return die('Command Line only');
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_end_flush();
|
ob_end_flush();
|
||||||
set_time_limit(300);
|
set_time_limit(300);
|
||||||
ini_set('max_execution_time', 300);
|
ini_set('max_execution_time', 300);
|
||||||
|
|
||||||
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
|
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
|
||||||
$path = getVideosDir();
|
$path = getVideosDir();
|
||||||
$total = Video::getTotalVideos("", false, true, true, false, false);
|
$total = Video::getTotalVideos("", false, true, true, false, false);
|
||||||
$videos = Video::getAllVideosLight("", false, true, false);
|
$videos = Video::getAllVideosLight("", false, true, false);
|
||||||
|
|
||||||
$checkAll = intval(@$argv[1]);
|
$checkAll = intval(@$argv[1]);
|
||||||
|
|
||||||
echo "Path: {$path}" . PHP_EOL;
|
echo "Path: {$path}" . PHP_EOL;
|
||||||
|
|
||||||
$sites_id_to_check = [];
|
$sites_id_to_check = [];
|
||||||
|
|
||||||
foreach ($videos as $value) {
|
foreach ($videos as $value) {
|
||||||
if ($value['status'] !== Video::$statusBrokenMissingFiles && empty($checkAll)) {
|
if ($value['status'] !== Video::STATUS_BROKEN_MISSING_FILES && empty($checkAll)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($value['type'] !== Video::$videoTypeVideo) {
|
if ($value['type'] !== Video::$videoTypeVideo) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$sites_id_to_check[] = $value['id'];
|
$sites_id_to_check[] = $value['id'];
|
||||||
echo "{$key}/{$total} added to review {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
|
echo "{$key}/{$total} added to review {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$total = count($sites_id_to_check);
|
$total = count($sites_id_to_check);
|
||||||
foreach ($sites_id_to_check as $key => $value) {
|
foreach ($sites_id_to_check as $key => $value) {
|
||||||
if (!empty($index) && $key<$index) {
|
if (!empty($index) && $key<$index) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$video = new Video('', '', $value);
|
$video = new Video('', '', $value);
|
||||||
$filename = $video->getFilename();
|
$filename = $video->getFilename();
|
||||||
|
|
||||||
echo "{$key}/{$total} Start check {$filename} " . PHP_EOL;
|
echo "{$key}/{$total} Start check {$filename} " . PHP_EOL;
|
||||||
if (Video::isMediaFileMissing($filename)) {
|
if (Video::isMediaFileMissing($filename)) {
|
||||||
$sources = getVideosURL_V2($filename);
|
$sources = getVideosURL_V2($filename);
|
||||||
echo "{$key}/{$total} is missing ". json_encode($sources) . PHP_EOL;
|
echo "{$key}/{$total} is missing ". json_encode($sources) . PHP_EOL;
|
||||||
} else if($video->getStatus()===Video::$statusBrokenMissingFiles){
|
} else if($video->getStatus()===Video::STATUS_BROKEN_MISSING_FILES){
|
||||||
$video->setStatus(Video::$statusActive);
|
$video->setStatus(Video::STATUS_ACTIVE);
|
||||||
echo "{$key}/{$total} is set to active " . PHP_EOL;
|
echo "{$key}/{$total} is set to active " . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo PHP_EOL . " Done! " . PHP_EOL;
|
echo PHP_EOL . " Done! " . PHP_EOL;
|
||||||
die();
|
die();
|
||||||
|
|
|
@ -203,8 +203,8 @@ if (!empty($_FILES['video']['tmp_name'])) {
|
||||||
} else {
|
} else {
|
||||||
$obj->lines[] = __LINE__;
|
$obj->lines[] = __LINE__;
|
||||||
// set encoding
|
// set encoding
|
||||||
$video->setStatus(Video::$statusEncoding);
|
$video->setStatus(Video::STATUS_ENCODING);
|
||||||
//$video->setAutoStatus(Video::$statusActive);
|
//$video->setAutoStatus(Video::STATUS_ACTIVE);
|
||||||
}
|
}
|
||||||
if (!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination_local}.jpg")) {
|
if (!empty($_FILES['image']['tmp_name']) && !file_exists("{$destination_local}.jpg")) {
|
||||||
$obj->lines[] = __LINE__;
|
$obj->lines[] = __LINE__;
|
||||||
|
|
|
@ -50,7 +50,7 @@ $video = new Video("", "", $_REQUEST['videos_id'], true);
|
||||||
$obj->video_id = $_REQUEST['videos_id'];
|
$obj->video_id = $_REQUEST['videos_id'];
|
||||||
|
|
||||||
|
|
||||||
$video->setAutoStatus(Video::$statusActive);
|
$video->setAutoStatus(Video::STATUS_ACTIVE);
|
||||||
|
|
||||||
$video_id = $video->save();
|
$video_id = $video->save();
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
$video = new Video(preg_replace("/_+/", " ", $path_parts['filename']), $filename, @$_FILES['upl']['videoId'], true);
|
$video = new Video(preg_replace("/_+/", " ", $path_parts['filename']), $filename, @$_FILES['upl']['videoId'], true);
|
||||||
$video->setDuration($duration);
|
$video->setDuration($duration);
|
||||||
$video->setType($type);
|
$video->setType($type);
|
||||||
$video->setStatus(Video::$statusEncoding);
|
$video->setStatus(Video::STATUS_ENCODING);
|
||||||
|
|
||||||
$id = $video->save($updateVideoGroups);
|
$id = $video->save($updateVideoGroups);
|
||||||
_error_log("AddQueueEncoder Video saved with ID: " . $id);
|
_error_log("AddQueueEncoder Video saved with ID: " . $id);
|
||||||
|
|
|
@ -31,7 +31,7 @@ function getVideoTagsFromVideo($video, $type)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ppv = AVideoPlugin::getObjectDataIfEnabled("PayPerView");
|
$ppv = AVideoPlugin::getObjectDataIfEnabled("PayPerView");
|
||||||
if ($video->getStatus() === Video::$statusFansOnly) {
|
if ($video->getStatus() === Video::STATUS_FANS_ONLY) {
|
||||||
$objTag->type = "warning";
|
$objTag->type = "warning";
|
||||||
$objTag->text = '<i class="fas fa-star" ></i>';
|
$objTag->text = '<i class="fas fa-star" ></i>';
|
||||||
$objTag->tooltip = __("Fans Only");
|
$objTag->tooltip = __("Fans Only");
|
||||||
|
@ -84,31 +84,31 @@ function getVideoTagVideoStatus($video, $type)
|
||||||
$status = $video->getStatus();
|
$status = $video->getStatus();
|
||||||
$objTag->text = __(Video::$statusDesc[$status]);
|
$objTag->text = __(Video::$statusDesc[$status]);
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
case Video::$statusActive:
|
case Video::STATUS_ACTIVE:
|
||||||
$objTag->type = "success";
|
$objTag->type = "success";
|
||||||
break;
|
break;
|
||||||
case Video::$statusActiveAndEncoding:
|
case Video::STATUS_ACTIVE_AND_ENCODING:
|
||||||
$objTag->type = "success";
|
$objTag->type = "success";
|
||||||
break;
|
break;
|
||||||
case Video::$statusInactive:
|
case Video::STATUS_INACTIVE:
|
||||||
$objTag->type = "warning";
|
$objTag->type = "warning";
|
||||||
break;
|
break;
|
||||||
case Video::$statusEncoding:
|
case Video::STATUS_ENCODING:
|
||||||
$objTag->type = "info";
|
$objTag->type = "info";
|
||||||
break;
|
break;
|
||||||
case Video::$statusDownloading:
|
case Video::STATUS_DOWNLOADING:
|
||||||
$objTag->type = "info";
|
$objTag->type = "info";
|
||||||
break;
|
break;
|
||||||
case Video::$statusUnlisted:
|
case Video::STATUS_UNLISTED:
|
||||||
$objTag->type = "info";
|
$objTag->type = "info";
|
||||||
break;
|
break;
|
||||||
case Video::$statusUnlistedButSearchable:
|
case Video::STATUS_UNLISTED_BUT_SEARCHABLE:
|
||||||
$objTag->type = "info";
|
$objTag->type = "info";
|
||||||
break;
|
break;
|
||||||
case Video::$statusRecording:
|
case Video::STATUS_RECORDING:
|
||||||
$objTag->type = "danger isRecording isRecordingIcon";
|
$objTag->type = "danger isRecording isRecordingIcon";
|
||||||
break;
|
break;
|
||||||
case Video::$statusDraft:
|
case Video::STATUS_DRAFT:
|
||||||
$objTag->type = "primary";
|
$objTag->type = "primary";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -558,7 +558,7 @@ class PlayList extends ObjectYPT
|
||||||
if (empty($playlists_id)) {
|
if (empty($playlists_id)) {
|
||||||
$sql = "SELECT 0 as playlists_id, id as videos_id FROM videos p WHERE status = ? ORDER BY `created` DESC ";
|
$sql = "SELECT 0 as playlists_id, id as videos_id FROM videos p WHERE status = ? ORDER BY `created` DESC ";
|
||||||
$formats = 's';
|
$formats = 's';
|
||||||
$values = [Video::$statusActive];
|
$values = [Video::STATUS_ACTIVE];
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT * FROM playlists_has_videos p WHERE playlists_id = ? " . self::getOrderBy('p.');
|
$sql = "SELECT * FROM playlists_has_videos p WHERE playlists_id = ? " . self::getOrderBy('p.');
|
||||||
$formats = 'i';
|
$formats = 'i';
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ if (typeof gtag !== \"function\") {
|
||||||
}
|
}
|
||||||
|
|
||||||
$video = new Video("", "", $videos_id);
|
$video = new Video("", "", $videos_id);
|
||||||
if ($video->getStatus() === Video::$statusInactive) {
|
if ($video->getStatus() === Video::STATUS_INACTIVE) {
|
||||||
$global['canWatchVideoReason'] = "Video is inactive";
|
$global['canWatchVideoReason'] = "Video is inactive";
|
||||||
_error_log("User::canWatchVideo Video is inactive ({$videos_id})");
|
_error_log("User::canWatchVideo Video is inactive ({$videos_id})");
|
||||||
self::setCacheWatchVideo($cacheName, false);
|
self::setCacheWatchVideo($cacheName, false);
|
||||||
|
@ -1088,7 +1088,7 @@ if (typeof gtag !== \"function\") {
|
||||||
}
|
}
|
||||||
|
|
||||||
$video = new Video("", "", $videos_id);
|
$video = new Video("", "", $videos_id);
|
||||||
if ($video->getStatus() === Video::$statusInactive) {
|
if ($video->getStatus() === Video::STATUS_INACTIVE) {
|
||||||
$global['canWatchVideoReason'] = "canWatchVideoWithAds: Video is inactive";
|
$global['canWatchVideoReason'] = "canWatchVideoWithAds: Video is inactive";
|
||||||
_error_log("User::canWatchVideoWithAds Video is inactive ({$videos_id})");
|
_error_log("User::canWatchVideoWithAds Video is inactive ({$videos_id})");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -71,55 +71,7 @@ if (!class_exists('Video')) {
|
||||||
protected $publish_datetime;
|
protected $publish_datetime;
|
||||||
protected $notification_datetime;
|
protected $notification_datetime;
|
||||||
protected $made_for_kids;
|
protected $made_for_kids;
|
||||||
public static $statusDesc = [
|
|
||||||
'a' => 'Active',
|
|
||||||
'k' => 'Active and Encoding',
|
|
||||||
'i' => 'Inactive',
|
|
||||||
'h' => 'Scheduled Release Date',
|
|
||||||
'e' => 'Encoding',
|
|
||||||
'x' => 'Encoding Error',
|
|
||||||
'd' => 'Downloading',
|
|
||||||
't' => 'Transferring',
|
|
||||||
'u' => 'Unlisted',
|
|
||||||
's' => 'Unlisted but Searchable',
|
|
||||||
'r' => 'Recording',
|
|
||||||
'f' => 'FansOnly',
|
|
||||||
'b' => 'Broken Missing files',
|
|
||||||
'p' => 'Unpublished',
|
|
||||||
'c' => 'Draft'
|
|
||||||
];
|
|
||||||
public static $statusIcons = [
|
|
||||||
'a' => '<i class=\'fas fa-eye\'></i>',
|
|
||||||
'k' => '<i class=\'fas fa-cog\'></i>',
|
|
||||||
'i' => '<i class=\'fas fa-eye-slash\'></i>',
|
|
||||||
'h' => '<i class=\'fas fa-clock\'></i>',
|
|
||||||
'e' => '<i class=\'fas fa-cog\'></i>',
|
|
||||||
'x' => '<i class=\'fas fa-exclamation-triangle\'></i>',
|
|
||||||
'd' => '<i class=\'fas fa-download\'></i>',
|
|
||||||
't' => '<i class=\'fas fa-sync\'></i>',
|
|
||||||
'u' => '<i class=\'fas fa-eye\' style=\'color: #BBB;\'></i>',
|
|
||||||
's' => '<i class=\'fas fa-search\' style=\'color: #BBB;\'></i>',
|
|
||||||
'r' => '<i class=\'fas fa-circle\'></i>',
|
|
||||||
'f' => '<i class=\'fas fa-star\'></i>',
|
|
||||||
'b' => '<i class=\'fas fa-times\'></i>',
|
|
||||||
'p' => '<i class=\'fas fa-ban\'></i>',
|
|
||||||
'c' => '<i class=\'fas fa-pencil-alt\'></i>'
|
|
||||||
];
|
|
||||||
public static $statusActive = 'a';
|
|
||||||
public static $statusActiveAndEncoding = 'k';
|
|
||||||
public static $statusInactive = 'i';
|
|
||||||
public static $statusScheduledReleaseDate = 'h';
|
|
||||||
public static $statusEncoding = 'e';
|
|
||||||
public static $statusEncodingError = 'x';
|
|
||||||
public static $statusDownloading = 'd';
|
|
||||||
public static $statusTranfering = 't';
|
|
||||||
public static $statusUnlisted = 'u';
|
|
||||||
public static $statusUnlistedButSearchable = 's';
|
|
||||||
public static $statusRecording = 'r';
|
|
||||||
public static $statusFansOnly = 'f';
|
|
||||||
public static $statusBrokenMissingFiles = 'b';
|
|
||||||
public static $statusUnpublished = 'p';
|
|
||||||
public static $statusDraft = 'c';
|
|
||||||
public static $rratingOptions = ['', 'g', 'pg', 'pg-13', 'r', 'nc-17', 'ma'];
|
public static $rratingOptions = ['', 'g', 'pg', 'pg-13', 'r', 'nc-17', 'ma'];
|
||||||
public static $rratingOptionsText = [
|
public static $rratingOptionsText = [
|
||||||
'g' => 'General Audience',
|
'g' => 'General Audience',
|
||||||
|
@ -174,6 +126,95 @@ if (!class_exists('Video')) {
|
||||||
const SORT_TYPE_SHORTS = 'shorts';
|
const SORT_TYPE_SHORTS = 'shorts';
|
||||||
const SORT_TYPE_DATEADDED = 'dateadded';
|
const SORT_TYPE_DATEADDED = 'dateadded';
|
||||||
|
|
||||||
|
// Status constants
|
||||||
|
const STATUS_ACTIVE = 'a';
|
||||||
|
const STATUS_ACTIVE_AND_ENCODING = 'k';
|
||||||
|
const STATUS_INACTIVE = 'i';
|
||||||
|
const STATUS_SCHEDULED_RELEASE_DATE = 'h';
|
||||||
|
const STATUS_ENCODING = 'e';
|
||||||
|
const STATUS_ENCODING_ERROR = 'x';
|
||||||
|
const STATUS_DOWNLOADING = 'd';
|
||||||
|
const STATUS_TRANFERING = 't';
|
||||||
|
const STATUS_UNLISTED = 'u';
|
||||||
|
const STATUS_UNLISTED_BUT_SEARCHABLE = 's';
|
||||||
|
const STATUS_RECORDING = 'r';
|
||||||
|
const STATUS_FANS_ONLY = 'f';
|
||||||
|
const STATUS_BROKEN_MISSING_FILES = 'b';
|
||||||
|
const STATUS_UNPUBLISHED = 'p';
|
||||||
|
const STATUS_DRAFT = 'c';
|
||||||
|
|
||||||
|
// Reuse constants in static arrays
|
||||||
|
public static $statusDesc = [
|
||||||
|
self::STATUS_ACTIVE => 'Active',
|
||||||
|
self::STATUS_ACTIVE_AND_ENCODING => 'Active and Encoding',
|
||||||
|
self::STATUS_INACTIVE => 'Inactive',
|
||||||
|
self::STATUS_SCHEDULED_RELEASE_DATE => 'Scheduled Release Date',
|
||||||
|
self::STATUS_ENCODING => 'Encoding',
|
||||||
|
self::STATUS_ENCODING_ERROR => 'Encoding Error',
|
||||||
|
self::STATUS_DOWNLOADING => 'Downloading',
|
||||||
|
self::STATUS_TRANFERING => 'Transferring',
|
||||||
|
self::STATUS_UNLISTED => 'Unlisted',
|
||||||
|
self::STATUS_UNLISTED_BUT_SEARCHABLE => 'Unlisted but Searchable',
|
||||||
|
self::STATUS_RECORDING => 'Recording',
|
||||||
|
self::STATUS_FANS_ONLY => 'FansOnly',
|
||||||
|
self::STATUS_BROKEN_MISSING_FILES => 'Broken Missing files',
|
||||||
|
self::STATUS_UNPUBLISHED => 'Unpublished',
|
||||||
|
self::STATUS_DRAFT => 'Draft'
|
||||||
|
];
|
||||||
|
|
||||||
|
public static $statusDescriptions = [
|
||||||
|
self::STATUS_ACTIVE => 'Active: The video is published and visible to users.',
|
||||||
|
self::STATUS_ACTIVE_AND_ENCODING => 'Active and Encoding: The video is published but still being processed/encoded.',
|
||||||
|
self::STATUS_INACTIVE => 'Inactive: The video is hidden and not available to users.',
|
||||||
|
self::STATUS_SCHEDULED_RELEASE_DATE => 'Scheduled Release Date: The video is scheduled to be published at a future date/time.',
|
||||||
|
self::STATUS_ENCODING => 'Encoding: The video is currently being encoded and is not yet available.',
|
||||||
|
self::STATUS_ENCODING_ERROR => 'Encoding Error: There was an error during encoding; the video is not available.',
|
||||||
|
self::STATUS_DOWNLOADING => 'Downloading: The video is being downloaded from an external source.',
|
||||||
|
self::STATUS_TRANFERING => 'Transferring: The video is being transferred between servers or locations.',
|
||||||
|
self::STATUS_UNLISTED => 'Unlisted: The video is not listed publicly but can be accessed via direct link.',
|
||||||
|
self::STATUS_UNLISTED_BUT_SEARCHABLE => 'Unlisted but Searchable: The video is not listed but can be found via search.',
|
||||||
|
self::STATUS_RECORDING => 'Recording: The video is currently being recorded (e.g., live stream).',
|
||||||
|
self::STATUS_FANS_ONLY => 'FansOnly: The video is restricted to fans or subscribers only.',
|
||||||
|
self::STATUS_BROKEN_MISSING_FILES => 'Broken Missing Files: The video is missing files or is corrupted.',
|
||||||
|
self::STATUS_UNPUBLISHED => 'Unpublished: The video is not published and not visible to users.',
|
||||||
|
self::STATUS_DRAFT => 'Draft: The video is a draft and not yet published.',
|
||||||
|
];
|
||||||
|
|
||||||
|
public static $statusIcons = [
|
||||||
|
self::STATUS_ACTIVE => '<i class=\'fas fa-eye\'></i>',
|
||||||
|
self::STATUS_ACTIVE_AND_ENCODING => '<i class=\'fas fa-cog\'></i>',
|
||||||
|
self::STATUS_INACTIVE => '<i class=\'fas fa-eye-slash\'></i>',
|
||||||
|
self::STATUS_SCHEDULED_RELEASE_DATE => '<i class=\'fas fa-clock\'></i>',
|
||||||
|
self::STATUS_ENCODING => '<i class=\'fas fa-cog\'></i>',
|
||||||
|
self::STATUS_ENCODING_ERROR => '<i class=\'fas fa-exclamation-triangle\'></i>',
|
||||||
|
self::STATUS_DOWNLOADING => '<i class=\'fas fa-download\'></i>',
|
||||||
|
self::STATUS_TRANFERING => '<i class=\'fas fa-sync\'></i>',
|
||||||
|
self::STATUS_UNLISTED => '<i class=\'fas fa-eye\' style=\'color: #BBB;\'></i>',
|
||||||
|
self::STATUS_UNLISTED_BUT_SEARCHABLE => '<i class=\'fas fa-search\' style=\'color: #BBB;\'></i>',
|
||||||
|
self::STATUS_RECORDING => '<i class=\'fas fa-circle\'></i>',
|
||||||
|
self::STATUS_FANS_ONLY => '<i class=\'fas fa-star\'></i>',
|
||||||
|
self::STATUS_BROKEN_MISSING_FILES => '<i class=\'fas fa-times\'></i>',
|
||||||
|
self::STATUS_UNPUBLISHED => '<i class=\'fas fa-ban\'></i>',
|
||||||
|
self::STATUS_DRAFT => '<i class=\'fas fa-pencil-alt\'></i>'
|
||||||
|
];
|
||||||
|
|
||||||
|
// this block will be removed in the future
|
||||||
|
public static $statusActive = self::STATUS_ACTIVE;
|
||||||
|
public static $statusActiveAndEncoding = self::STATUS_ACTIVE_AND_ENCODING;
|
||||||
|
public static $statusInactive = self::STATUS_INACTIVE;
|
||||||
|
public static $statusScheduledReleaseDate = self::STATUS_SCHEDULED_RELEASE_DATE;
|
||||||
|
public static $statusEncoding = self::STATUS_ENCODING;
|
||||||
|
public static $statusEncodingError = self::STATUS_ENCODING_ERROR;
|
||||||
|
public static $statusDownloading = self::STATUS_DOWNLOADING;
|
||||||
|
public static $statusTranfering = self::STATUS_TRANFERING;
|
||||||
|
public static $statusUnlisted = self::STATUS_UNLISTED;
|
||||||
|
public static $statusUnlistedButSearchable = self::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||||
|
public static $statusRecording = self::STATUS_RECORDING;
|
||||||
|
public static $statusFansOnly = self::STATUS_FANS_ONLY;
|
||||||
|
public static $statusBrokenMissingFiles = self::STATUS_BROKEN_MISSING_FILES;
|
||||||
|
public static $statusUnpublished = self::STATUS_UNPUBLISHED;
|
||||||
|
public static $statusDraft = self::STATUS_DRAFT;
|
||||||
|
|
||||||
|
|
||||||
public function __construct($title = "", $filename = "", $id = 0, $refreshCache = false)
|
public function __construct($title = "", $filename = "", $id = 0, $refreshCache = false)
|
||||||
{
|
{
|
||||||
|
@ -511,9 +552,9 @@ if (!class_exists('Video')) {
|
||||||
if (empty($this->status) || empty(self::$statusDesc[$this->status])) {
|
if (empty($this->status) || empty(self::$statusDesc[$this->status])) {
|
||||||
_error_log("Video::save status is empty or not valid {$this->status} " . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
_error_log("Video::save status is empty or not valid {$this->status} " . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
||||||
if ($this->type != self::$videoTypeVideo) {
|
if ($this->type != self::$videoTypeVideo) {
|
||||||
$this->status = Video::$statusActive;
|
$this->status = Video::STATUS_ACTIVE;
|
||||||
} else {
|
} else {
|
||||||
$this->status = Video::$statusEncoding;
|
$this->status = Video::STATUS_ENCODING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,8 +914,8 @@ if (!class_exists('Video')) {
|
||||||
|
|
||||||
public function setStatus($status)
|
public function setStatus($status)
|
||||||
{
|
{
|
||||||
if ($status === Video::$statusBrokenMissingFiles) {
|
if ($status === Video::STATUS_BROKEN_MISSING_FILES) {
|
||||||
if (empty($this->status) || $this->status !== Video::$statusBrokenMissingFiles) {
|
if (empty($this->status) || $this->status !== Video::STATUS_BROKEN_MISSING_FILES) {
|
||||||
_error_log("Video::setStatus({$status}) set to statusBrokenMissingFiles id = {$this->id} " . json_encode(debug_backtrace()), AVideoLog::$WARNING);
|
_error_log("Video::setStatus({$status}) set to statusBrokenMissingFiles id = {$this->id} " . json_encode(debug_backtrace()), AVideoLog::$WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -883,14 +924,14 @@ if (!class_exists('Video')) {
|
||||||
global $global;
|
global $global;
|
||||||
|
|
||||||
if (empty($status)) {
|
if (empty($status)) {
|
||||||
$status = Video::$statusActive;
|
$status = Video::STATUS_ACTIVE;
|
||||||
}
|
}
|
||||||
if (empty(Video::$statusDesc[$status])) {
|
if (empty(Video::$statusDesc[$status])) {
|
||||||
_error_log("Video::setStatus({$status}) NOT found " . json_encode(debug_backtrace()), AVideoLog::$WARNING);
|
_error_log("Video::setStatus({$status}) NOT found " . json_encode(debug_backtrace()), AVideoLog::$WARNING);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->status == Video::$statusUnpublished) {
|
if ($this->status == Video::STATUS_UNPUBLISHED) {
|
||||||
if (!User::isAdmin() && !Permissions::canModerateVideos()) {
|
if (!User::isAdmin() && !Permissions::canModerateVideos()) {
|
||||||
_error_log("Video::setStatus({$status}) Only modetrators can publish videos ", AVideoLog::$WARNING);
|
_error_log("Video::setStatus({$status}) Only modetrators can publish videos ", AVideoLog::$WARNING);
|
||||||
return false;
|
return false;
|
||||||
|
@ -910,17 +951,17 @@ if (!class_exists('Video')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
self::clearCache($this->id);
|
self::clearCache($this->id);
|
||||||
if ($this->status == Video::$statusActive || $status == Video::$statusActive && ($this->status != $status)) {
|
if ($this->status == Video::STATUS_ACTIVE || $status == Video::STATUS_ACTIVE && ($this->status != $status)) {
|
||||||
|
|
||||||
$doNotNotify = array(
|
$doNotNotify = array(
|
||||||
Video::$statusInactive,
|
Video::STATUS_INACTIVE,
|
||||||
Video::$statusUnlisted,
|
Video::STATUS_UNLISTED,
|
||||||
Video::$statusUnlistedButSearchable,
|
Video::STATUS_UNLISTED_BUT_SEARCHABLE,
|
||||||
Video::$statusFansOnly,
|
Video::STATUS_FANS_ONLY,
|
||||||
Video::$statusBrokenMissingFiles,
|
Video::STATUS_BROKEN_MISSING_FILES,
|
||||||
Video::$statusDraft
|
Video::STATUS_DRAFT
|
||||||
);
|
);
|
||||||
if (!in_array($this->status, $doNotNotify) && $status == Video::$statusActive) {
|
if (!in_array($this->status, $doNotNotify) && $status == Video::STATUS_ACTIVE) {
|
||||||
_error_log("Video::setStatus({$status}) AVideoPlugin::onNewVideo ");
|
_error_log("Video::setStatus({$status}) AVideoPlugin::onNewVideo ");
|
||||||
$notTriggerOnNewVideo = array(
|
$notTriggerOnNewVideo = array(
|
||||||
'aVideoEncoder.json.php',
|
'aVideoEncoder.json.php',
|
||||||
|
@ -962,25 +1003,25 @@ if (!class_exists('Video')) {
|
||||||
$advancedCustom = AVideoPlugin::getDataObject('CustomizeAdvanced');
|
$advancedCustom = AVideoPlugin::getDataObject('CustomizeAdvanced');
|
||||||
}
|
}
|
||||||
if (!empty($_POST['fail'])) {
|
if (!empty($_POST['fail'])) {
|
||||||
return $this->setStatus(Video::$statusEncodingError);
|
return $this->setStatus(Video::STATUS_ENCODING_ERROR);
|
||||||
} else {
|
} else {
|
||||||
if ($advancedCustom->enableVideoModeration) {
|
if ($advancedCustom->enableVideoModeration) {
|
||||||
return $this->setStatus(Video::$statusUnpublished);
|
return $this->setStatus(Video::STATUS_UNPUBLISHED);
|
||||||
} else if ($this->isScheduledForRelease()) {
|
} else if ($this->isScheduledForRelease()) {
|
||||||
return $this->setStatus(Video::$statusScheduledReleaseDate);
|
return $this->setStatus(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||||
} else
|
} else
|
||||||
if (!empty($_REQUEST['overrideStatus'])) {
|
if (!empty($_REQUEST['overrideStatus'])) {
|
||||||
return $this->setStatus($_REQUEST['overrideStatus']);
|
return $this->setStatus($_REQUEST['overrideStatus']);
|
||||||
} else if (!empty($_REQUEST['releaseDate']) && $_REQUEST['releaseDate'] !== 'now') {
|
} else if (!empty($_REQUEST['releaseDate']) && $_REQUEST['releaseDate'] !== 'now') {
|
||||||
return $this->setStatus(Video::$statusScheduledReleaseDate);
|
return $this->setStatus(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||||
} else { // encoder did not provide a status
|
} else { // encoder did not provide a status
|
||||||
AVideoPlugin::loadPlugin('Scheduler');
|
AVideoPlugin::loadPlugin('Scheduler');
|
||||||
$row = Scheduler::isActiveFromVideosId($this->id);
|
$row = Scheduler::isActiveFromVideosId($this->id);
|
||||||
if (!empty($row)) { // there is a schedule to activate the video
|
if (!empty($row)) { // there is a schedule to activate the video
|
||||||
return $this->setStatus(Video::$statusScheduledReleaseDate);
|
return $this->setStatus(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||||
} else {
|
} else {
|
||||||
if (!empty($_REQUEST['keepEncoding'])) {
|
if (!empty($_REQUEST['keepEncoding'])) {
|
||||||
return $this->setStatus(Video::$statusActiveAndEncoding);
|
return $this->setStatus(Video::STATUS_ACTIVE_AND_ENCODING);
|
||||||
} else {
|
} else {
|
||||||
if ($this->getTitle() !== "Video automatically booked") {
|
if ($this->getTitle() !== "Video automatically booked") {
|
||||||
$typesToBeAutoDraft = array(
|
$typesToBeAutoDraft = array(
|
||||||
|
@ -991,14 +1032,14 @@ if (!class_exists('Video')) {
|
||||||
Video::$videoTypeZip,
|
Video::$videoTypeZip,
|
||||||
Video::$videoTypeGallery,
|
Video::$videoTypeGallery,
|
||||||
);
|
);
|
||||||
if (in_array($this->type, $typesToBeAutoDraft)){
|
if (in_array($this->type, $typesToBeAutoDraft)) {
|
||||||
return $this->setStatus(Video::$statusDraft);
|
return $this->setStatus(Video::STATUS_DRAFT);
|
||||||
}else{
|
} else {
|
||||||
_error_log("Video::setAutoStatus({$this->type}) set to default status " . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
_error_log("Video::setAutoStatus({$this->type}) set to default status " . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
||||||
return $this->setStatus($advancedCustom->defaultVideoStatus->value);
|
return $this->setStatus($advancedCustom->defaultVideoStatus->value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return $this->setStatus(Video::$statusInactive);
|
return $this->setStatus(Video::STATUS_INACTIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1147,26 +1188,26 @@ if (!class_exists('Video')) {
|
||||||
if ($status == Video::SORT_TYPE_VIEWABLE) {
|
if ($status == Video::SORT_TYPE_VIEWABLE) {
|
||||||
if (User::isLogged()) {
|
if (User::isLogged()) {
|
||||||
$sql .= " AND ((v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') ";
|
$sql .= " AND ((v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') ";
|
||||||
$sql .= " OR ((v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') ";
|
$sql .= " OR ((v.status='" . Video::STATUS_UNLISTED . "' OR v.status='" . Video::STATUS_UNLISTED_BUT_SEARCHABLE . "') ";
|
||||||
if (!User::isAdmin() && !Permissions::canAdminVideos()) {
|
if (!User::isAdmin() && !Permissions::canAdminVideos()) {
|
||||||
$sql .= " AND (v.users_id ='" . User::getId() . "' OR v.users_id_company = '" . User::getId() . "')";
|
$sql .= " AND (v.users_id ='" . User::getId() . "' OR v.users_id_company = '" . User::getId() . "')";
|
||||||
}
|
}
|
||||||
$sql .= " ))";
|
$sql .= " ))";
|
||||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') )";
|
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::STATUS_UNLISTED . "' OR v.status='" . Video::STATUS_UNLISTED_BUT_SEARCHABLE . "') )";
|
||||||
$sql .= " )";
|
$sql .= " )";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND ( v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
|
$sql .= " AND ( v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
|
||||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') )";
|
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::STATUS_UNLISTED . "' OR v.status='" . Video::STATUS_UNLISTED_BUT_SEARCHABLE . "') )";
|
||||||
$sql .= " )";
|
$sql .= " )";
|
||||||
}
|
}
|
||||||
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
|
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
|
||||||
$sql .= " AND ( v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
|
$sql .= " AND ( v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
|
||||||
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') )";
|
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::STATUS_UNLISTED . "' OR v.status='" . Video::STATUS_UNLISTED_BUT_SEARCHABLE . "') )";
|
||||||
$sql .= " )";
|
$sql .= " )";
|
||||||
} elseif ($status == Video::SORT_TYPE_PUBLICONLY) {
|
} elseif ($status == Video::SORT_TYPE_PUBLICONLY) {
|
||||||
$sql .= " AND v.status IN ('" . Video::$statusActive . "', '" . Video::$statusActiveAndEncoding . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
|
$sql .= " AND v.status IN ('" . Video::STATUS_ACTIVE . "', '" . Video::STATUS_ACTIVE_AND_ENCODING . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
|
||||||
} elseif ($status == Video::SORT_TYPE_PRIVATEONLY) {
|
} elseif ($status == Video::SORT_TYPE_PRIVATEONLY) {
|
||||||
$sql .= " AND v.status IN ('" . Video::$statusActive . "', '" . Video::$statusActiveAndEncoding . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) > 0";
|
$sql .= " AND v.status IN ('" . Video::STATUS_ACTIVE . "', '" . Video::STATUS_ACTIVE_AND_ENCODING . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) > 0";
|
||||||
} elseif ($status == Video::SORT_TYPE_SHORTS) {
|
} elseif ($status == Video::SORT_TYPE_SHORTS) {
|
||||||
$ShortsObj = AVideoPlugin::getDataObject("Shorts");
|
$ShortsObj = AVideoPlugin::getDataObject("Shorts");
|
||||||
if (!empty($ShortsObj)) {
|
if (!empty($ShortsObj)) {
|
||||||
|
@ -1197,7 +1238,7 @@ if (!class_exists('Video')) {
|
||||||
|
|
||||||
switch ($sortType) {
|
switch ($sortType) {
|
||||||
case Video::SORT_TYPE_SUGGESTED:
|
case Video::SORT_TYPE_SUGGESTED:
|
||||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||||
$sql .= " ORDER BY RAND() ";
|
$sql .= " ORDER BY RAND() ";
|
||||||
$sql .= BootGrid::getSqlFromPost([], empty($_POST['sort']['likes']) ? "v." : "", "", true);
|
$sql .= BootGrid::getSqlFromPost([], empty($_POST['sort']['likes']) ? "v." : "", "", true);
|
||||||
if (strpos(mb_strtolower($sql), 'limit') === false) {
|
if (strpos(mb_strtolower($sql), 'limit') === false) {
|
||||||
|
@ -1390,9 +1431,9 @@ if (!class_exists('Video')) {
|
||||||
$sql .= " v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
|
$sql .= " v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
|
||||||
/* If I keep the code below it will appear on first page
|
/* If I keep the code below it will appear on first page
|
||||||
if (User::isAdmin()) {
|
if (User::isAdmin()) {
|
||||||
$sql .= " OR v.status = '" . Video::$statusUnpublished . "' ";
|
$sql .= " OR v.status = '" . Video::STATUS_UNPUBLISHED . "' ";
|
||||||
} else if (User::isLogged()) {
|
} else if (User::isLogged()) {
|
||||||
$sql .= " OR (v.status = '" . Video::$statusUnpublished . "' AND v.users_id = '" . User::getId() . "' )";
|
$sql .= " OR (v.status = '" . Video::STATUS_UNPUBLISHED . "' AND v.users_id = '" . User::getId() . "' )";
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$sql .= " )";
|
$sql .= " )";
|
||||||
|
@ -1401,9 +1442,9 @@ if (!class_exists('Video')) {
|
||||||
$sql .= " v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
|
$sql .= " v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
|
||||||
/*If I keep the code below it will appear on first page
|
/*If I keep the code below it will appear on first page
|
||||||
if (User::isAdmin()) {
|
if (User::isAdmin()) {
|
||||||
$sql .= " OR v.status = '" . Video::$statusUnpublished . "' ";
|
$sql .= " OR v.status = '" . Video::STATUS_UNPUBLISHED . "' ";
|
||||||
} else if (User::isLogged()) {
|
} else if (User::isLogged()) {
|
||||||
$sql .= " OR (v.status = '" . Video::$statusUnpublished . "' AND v.users_id = '" . User::getId() . "' )";
|
$sql .= " OR (v.status = '" . Video::STATUS_UNPUBLISHED . "' AND v.users_id = '" . User::getId() . "' )";
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$sql .= " )";
|
$sql .= " )";
|
||||||
|
@ -1467,7 +1508,7 @@ if (!class_exists('Video')) {
|
||||||
$firstClauseLimit = '';
|
$firstClauseLimit = '';
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
if ($suggestedOnly) {
|
if ($suggestedOnly) {
|
||||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||||
}
|
}
|
||||||
if (empty($random) && !empty($_GET['videoName'])) {
|
if (empty($random) && !empty($_GET['videoName'])) {
|
||||||
$videoName = addcslashes($_GET['videoName'], "'");
|
$videoName = addcslashes($_GET['videoName'], "'");
|
||||||
|
@ -1486,7 +1527,7 @@ if (!class_exists('Video')) {
|
||||||
//var_dump($rand, $numRows);
|
//var_dump($rand, $numRows);
|
||||||
//$sql .= " ORDER BY RAND() ";
|
//$sql .= " ORDER BY RAND() ";
|
||||||
} elseif ($suggestedOnly && empty($_GET['videoName']) && empty($_GET['search']) && empty($_GET['searchPhrase'])) {
|
} elseif ($suggestedOnly && empty($_GET['videoName']) && empty($_GET['search']) && empty($_GET['searchPhrase'])) {
|
||||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||||
$numRows = self::getTotalVideos($status, false, $ignoreGroup, $showUnlisted, $activeUsersOnly, $suggestedOnly);
|
$numRows = self::getTotalVideos($status, false, $ignoreGroup, $showUnlisted, $activeUsersOnly, $suggestedOnly);
|
||||||
if ($numRows <= 2) {
|
if ($numRows <= 2) {
|
||||||
$rand = 0;
|
$rand = 0;
|
||||||
|
@ -1708,10 +1749,10 @@ if (!class_exists('Video')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$serie_playlists_id = $video['serie_playlists_id'];
|
$serie_playlists_id = $video['serie_playlists_id'];
|
||||||
if(empty($serie_playlists_id) && !empty($_REQUEST['serie_playlists_id'])){
|
if (empty($serie_playlists_id) && !empty($_REQUEST['serie_playlists_id'])) {
|
||||||
$serie_playlists_id = intval($video['serie_playlists_id']);
|
$serie_playlists_id = intval($video['serie_playlists_id']);
|
||||||
}
|
}
|
||||||
if(!empty($serie_playlists_id)){
|
if (!empty($serie_playlists_id)) {
|
||||||
unset($_REQUEST['serie_playlists_id']);
|
unset($_REQUEST['serie_playlists_id']);
|
||||||
$videosArrayId = PlayList::getVideosIdFromPlaylist($serie_playlists_id);
|
$videosArrayId = PlayList::getVideosIdFromPlaylist($serie_playlists_id);
|
||||||
$rows = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
|
$rows = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
|
||||||
|
@ -2597,7 +2638,7 @@ if (!class_exists('Video')) {
|
||||||
if ($status == Video::SORT_TYPE_VIEWABLE) {
|
if ($status == Video::SORT_TYPE_VIEWABLE) {
|
||||||
if (User::isLogged()) {
|
if (User::isLogged()) {
|
||||||
$sql .= " AND (v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') ";
|
$sql .= " AND (v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') ";
|
||||||
$sql .= " OR (v.status='" . Video::$statusUnlisted . "' ";
|
$sql .= " OR (v.status='" . Video::STATUS_UNLISTED . "' ";
|
||||||
if (!User::isAdmin() && !Permissions::canAdminVideos()) {
|
if (!User::isAdmin() && !Permissions::canAdminVideos()) {
|
||||||
$sql .= " AND (v.users_id ='" . User::getId() . "' OR v.users_id_company = '" . User::getId() . "')";
|
$sql .= " AND (v.users_id ='" . User::getId() . "' OR v.users_id_company = '" . User::getId() . "')";
|
||||||
}
|
}
|
||||||
|
@ -2633,7 +2674,7 @@ if (!class_exists('Video')) {
|
||||||
$sql .= AVideoPlugin::getVideoWhereClause();
|
$sql .= AVideoPlugin::getVideoWhereClause();
|
||||||
|
|
||||||
if ($suggestedOnly) {
|
if ($suggestedOnly) {
|
||||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||||
$sql .= " ORDER BY RAND() ";
|
$sql .= " ORDER BY RAND() ";
|
||||||
} else if ($with_order_only) {
|
} else if ($with_order_only) {
|
||||||
$sql .= " ORDER BY v.`order` ASC ";
|
$sql .= " ORDER BY v.`order` ASC ";
|
||||||
|
@ -2861,7 +2902,7 @@ if (!class_exists('Video')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($suggestedOnly) {
|
if ($suggestedOnly) {
|
||||||
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
|
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::STATUS_ACTIVE . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2961,18 +3002,18 @@ if (!class_exists('Video')) {
|
||||||
|
|
||||||
public static function getViewableStatus($showUnlisted = false)
|
public static function getViewableStatus($showUnlisted = false)
|
||||||
{
|
{
|
||||||
$viewable = [Video::$statusActive, Video::$statusActiveAndEncoding, Video::$statusFansOnly];
|
$viewable = [Video::STATUS_ACTIVE, Video::STATUS_ACTIVE_AND_ENCODING, Video::STATUS_FANS_ONLY];
|
||||||
if ($showUnlisted) {
|
if ($showUnlisted) {
|
||||||
$viewable[] = Video::$statusUnlisted;
|
$viewable[] = Video::STATUS_UNLISTED;
|
||||||
$viewable[] = Video::$statusUnlistedButSearchable;
|
$viewable[] = Video::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||||
} else {
|
} else {
|
||||||
$search = getSearchVar();
|
$search = getSearchVar();
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$viewable[] = Video::$statusUnlistedButSearchable;
|
$viewable[] = Video::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (User::isAdmin()) {
|
if (User::isAdmin()) {
|
||||||
$viewable[] = Video::$statusScheduledReleaseDate;
|
$viewable[] = Video::STATUS_SCHEDULED_RELEASE_DATE;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Cannot do that otherwise it will list videos on the list videos menu
|
* Cannot do that otherwise it will list videos on the list videos menu
|
||||||
|
@ -3693,7 +3734,7 @@ if (!class_exists('Video')) {
|
||||||
$response = array('videos_id' => $videos_id);
|
$response = array('videos_id' => $videos_id);
|
||||||
$video = new Video("", "", $videos_id);
|
$video = new Video("", "", $videos_id);
|
||||||
$ppv = AVideoPlugin::getObjectDataIfEnabled("PayPerView");
|
$ppv = AVideoPlugin::getObjectDataIfEnabled("PayPerView");
|
||||||
$response['fans_only'] = $video->getStatus() === self::$statusFansOnly;
|
$response['fans_only'] = $video->getStatus() === self::STATUS_FANS_ONLY;
|
||||||
if ($response['fans_only'] && AVideoPlugin::isEnabledByName("FansSubscriptions")) {
|
if ($response['fans_only'] && AVideoPlugin::isEnabledByName("FansSubscriptions")) {
|
||||||
$response['fans_only_info'] = FansSubscriptions::getPlansFromUsersID($video->getUsers_id());
|
$response['fans_only_info'] = FansSubscriptions::getPlansFromUsersID($video->getUsers_id());
|
||||||
}
|
}
|
||||||
|
@ -4835,7 +4876,7 @@ if (!class_exists('Video')) {
|
||||||
if ($v['type'] !== 'video') {
|
if ($v['type'] !== 'video') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if ($v['status'] !== self::$statusActive && $v['status'] !== self::$statusUnlisted && $v['status'] !== self::$statusUnlistedButSearchable) {
|
if ($v['status'] !== self::STATUS_ACTIVE && $v['status'] !== self::STATUS_UNLISTED && $v['status'] !== self::STATUS_UNLISTED_BUT_SEARCHABLE) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$video = new Video('', '', $v['id']);
|
$video = new Video('', '', $v['id']);
|
||||||
|
@ -6133,22 +6174,22 @@ if (!class_exists('Video')) {
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($video->getStatus() == Video::$statusInactive) {
|
if ($video->getStatus() == Video::STATUS_INACTIVE) {
|
||||||
$response->canWatch = false;
|
$response->canWatch = false;
|
||||||
$response->why[] = "This video is inactive";
|
$response->why[] = "This video is inactive";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($video->getStatus() == Video::$statusBrokenMissingFiles) {
|
if ($video->getStatus() == Video::STATUS_BROKEN_MISSING_FILES) {
|
||||||
$response->canWatch = false;
|
$response->canWatch = false;
|
||||||
$response->why[] = "This video is broken";
|
$response->why[] = "This video is broken";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($video->getStatus() == Video::$statusEncoding) {
|
if ($video->getStatus() == Video::STATUS_ENCODING) {
|
||||||
$response->canWatch = false;
|
$response->canWatch = false;
|
||||||
$response->why[] = "This video is encoding, please wait";
|
$response->why[] = "This video is encoding, please wait";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($video->getStatus() == Video::$statusTranfering) {
|
if ($video->getStatus() == Video::STATUS_TRANFERING) {
|
||||||
$response->canWatch = false;
|
$response->canWatch = false;
|
||||||
$response->why[] = "This video is still transfering, please wait";
|
$response->why[] = "This video is still transfering, please wait";
|
||||||
}
|
}
|
||||||
|
@ -7137,12 +7178,12 @@ if (!class_exists('Video')) {
|
||||||
$_checkIfIsBrokenList[$videos_id] = false;
|
$_checkIfIsBrokenList[$videos_id] = false;
|
||||||
return $_checkIfIsBrokenList[$videos_id];
|
return $_checkIfIsBrokenList[$videos_id];
|
||||||
}
|
}
|
||||||
if ($video->getStatus() == Video::$statusActive || $video->getStatus() == Video::$statusUnlisted || $video->getStatus() == Video::$statusUnlistedButSearchable) {
|
if ($video->getStatus() == Video::STATUS_ACTIVE || $video->getStatus() == Video::STATUS_UNLISTED || $video->getStatus() == Video::STATUS_UNLISTED_BUT_SEARCHABLE) {
|
||||||
if ($video->getType() == Video::$videoTypeAudio || $video->getType() == Video::$videoTypeVideo) {
|
if ($video->getType() == Video::$videoTypeAudio || $video->getType() == Video::$videoTypeVideo) {
|
||||||
$checkIfIsBroken++;
|
$checkIfIsBroken++;
|
||||||
if (self::isMediaFileMissing($video->getFilename())) {
|
if (self::isMediaFileMissing($video->getFilename())) {
|
||||||
_error_log("Video::checkIfIsBroken($videos_id) true " . $video->getFilename() . ' status=[' . $video->getStatus() . ']' . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
_error_log("Video::checkIfIsBroken($videos_id) true " . $video->getFilename() . ' status=[' . $video->getStatus() . ']' . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
|
||||||
$video->setStatus(Video::$statusBrokenMissingFiles);
|
$video->setStatus(Video::STATUS_BROKEN_MISSING_FILES);
|
||||||
Video::clearCache($videos_id);
|
Video::clearCache($videos_id);
|
||||||
$_checkIfIsBrokenList[$videos_id] = true;
|
$_checkIfIsBrokenList[$videos_id] = true;
|
||||||
return $_checkIfIsBrokenList[$videos_id];
|
return $_checkIfIsBrokenList[$videos_id];
|
||||||
|
@ -7150,7 +7191,7 @@ if (!class_exists('Video')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_checkIfIsBrokenList[$videos_id] = $video->getStatus() == Video::$statusBrokenMissingFiles;
|
$_checkIfIsBrokenList[$videos_id] = $video->getStatus() == Video::STATUS_BROKEN_MISSING_FILES;
|
||||||
return $_checkIfIsBrokenList[$videos_id];
|
return $_checkIfIsBrokenList[$videos_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7296,7 +7337,7 @@ if (!class_exists('Video')) {
|
||||||
static public function getAllActiveEPGs()
|
static public function getAllActiveEPGs()
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
$sql = "SELECT * FROM `videos` WHERE status = '" . Video::$statusActive . "' "
|
$sql = "SELECT * FROM `videos` WHERE status = '" . Video::STATUS_ACTIVE . "' "
|
||||||
. "AND `type` = 'linkVideo' "
|
. "AND `type` = 'linkVideo' "
|
||||||
. "AND epg_link IS NOT NULL "
|
. "AND epg_link IS NOT NULL "
|
||||||
. "AND epg_link != ''";
|
. "AND epg_link != ''";
|
||||||
|
@ -7400,11 +7441,11 @@ if (!class_exists('Video')) {
|
||||||
static function deleteUselessOldVideos($days)
|
static function deleteUselessOldVideos($days)
|
||||||
{
|
{
|
||||||
$arrayStatusToDelete = array(
|
$arrayStatusToDelete = array(
|
||||||
Video::$statusBrokenMissingFiles,
|
Video::STATUS_BROKEN_MISSING_FILES,
|
||||||
Video::$statusDownloading,
|
Video::STATUS_DOWNLOADING,
|
||||||
Video::$statusEncoding,
|
Video::STATUS_ENCODING,
|
||||||
Video::$statusEncodingError,
|
Video::STATUS_ENCODING_ERROR,
|
||||||
Video::$statusTranfering,
|
Video::STATUS_TRANFERING,
|
||||||
);
|
);
|
||||||
$daysAgo = date("Y-m-d H:i:s", strtotime("-{$days} days"));
|
$daysAgo = date("Y-m-d H:i:s", strtotime("-{$days} days"));
|
||||||
$sql = "SELECT * FROM videos WHERE status IN ('" . implode("', '", $arrayStatusToDelete) . "') AND created < ? ";
|
$sql = "SELECT * FROM videos WHERE status IN ('" . implode("', '", $arrayStatusToDelete) . "') AND created < ? ";
|
||||||
|
@ -7615,40 +7656,40 @@ if (!empty($_GET['v']) && empty($_GET['videoName'])) {
|
||||||
}
|
}
|
||||||
global $statusThatShowTheCompleteMenu, $statusSearchFilter, $statusThatTheUserCanUpdate;
|
global $statusThatShowTheCompleteMenu, $statusSearchFilter, $statusThatTheUserCanUpdate;
|
||||||
$statusThatShowTheCompleteMenu = [
|
$statusThatShowTheCompleteMenu = [
|
||||||
Video::$statusActive,
|
Video::STATUS_ACTIVE,
|
||||||
Video::$statusInactive,
|
Video::STATUS_INACTIVE,
|
||||||
Video::$statusScheduledReleaseDate,
|
Video::STATUS_SCHEDULED_RELEASE_DATE,
|
||||||
Video::$statusActiveAndEncoding,
|
Video::STATUS_ACTIVE_AND_ENCODING,
|
||||||
Video::$statusUnlistedButSearchable,
|
Video::STATUS_UNLISTED_BUT_SEARCHABLE,
|
||||||
Video::$statusUnlisted,
|
Video::STATUS_UNLISTED,
|
||||||
Video::$statusFansOnly,
|
Video::STATUS_FANS_ONLY,
|
||||||
Video::$statusUnpublished,
|
Video::STATUS_UNPUBLISHED,
|
||||||
Video::$statusDraft,
|
Video::STATUS_DRAFT,
|
||||||
];
|
];
|
||||||
|
|
||||||
$statusSearchFilter = [
|
$statusSearchFilter = [
|
||||||
Video::$statusActive,
|
Video::STATUS_ACTIVE,
|
||||||
Video::$statusInactive,
|
Video::STATUS_INACTIVE,
|
||||||
Video::$statusScheduledReleaseDate,
|
Video::STATUS_SCHEDULED_RELEASE_DATE,
|
||||||
Video::$statusEncoding,
|
Video::STATUS_ENCODING,
|
||||||
Video::$statusTranfering,
|
Video::STATUS_TRANFERING,
|
||||||
Video::$statusUnlisted,
|
Video::STATUS_UNLISTED,
|
||||||
Video::$statusUnlistedButSearchable,
|
Video::STATUS_UNLISTED_BUT_SEARCHABLE,
|
||||||
Video::$statusBrokenMissingFiles,
|
Video::STATUS_BROKEN_MISSING_FILES,
|
||||||
Video::$statusUnpublished,
|
Video::STATUS_UNPUBLISHED,
|
||||||
Video::$statusDraft,
|
Video::STATUS_DRAFT,
|
||||||
];
|
];
|
||||||
|
|
||||||
$statusThatTheUserCanUpdate = [
|
$statusThatTheUserCanUpdate = [
|
||||||
[Video::$statusDraft, '#00B'],
|
[Video::STATUS_DRAFT, '#00B'],
|
||||||
[Video::$statusActive, '#0A0'],
|
[Video::STATUS_ACTIVE, '#0A0'],
|
||||||
[Video::$statusInactive, '#B00'],
|
[Video::STATUS_INACTIVE, '#B00'],
|
||||||
[Video::$statusUnlisted, '#AAA'],
|
[Video::STATUS_UNLISTED, '#AAA'],
|
||||||
[Video::$statusUnlistedButSearchable, '#888'],
|
[Video::STATUS_UNLISTED_BUT_SEARCHABLE, '#888'],
|
||||||
];
|
];
|
||||||
|
|
||||||
AVideoPlugin::loadPlugin('Permissions');
|
AVideoPlugin::loadPlugin('Permissions');
|
||||||
if (User::isAdmin() || Permissions::canModerateVideos()) {
|
if (User::isAdmin() || Permissions::canModerateVideos()) {
|
||||||
$statusThatTheUserCanUpdate[] = [Video::$statusUnpublished, '#B00'];
|
$statusThatTheUserCanUpdate[] = [Video::STATUS_UNPUBLISHED, '#B00'];
|
||||||
}
|
}
|
||||||
//Video::videoMadeForKidsExists();exit;
|
//Video::videoMadeForKidsExists();exit;
|
||||||
|
|
|
@ -154,7 +154,7 @@ if (empty($_POST['id'])) {
|
||||||
$obj->setType($_POST['videoLinkType']);
|
$obj->setType($_POST['videoLinkType']);
|
||||||
}
|
}
|
||||||
$rowsPath[] = array('line' => __LINE__, 'ElapsedTime' => getElapsedTime());
|
$rowsPath[] = array('line' => __LINE__, 'ElapsedTime' => getElapsedTime());
|
||||||
$obj->setAutoStatus(Video::$statusDraft);
|
$obj->setAutoStatus(Video::STATUS_DRAFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeLogEnd(__FILE__, __LINE__);
|
TimeLogEnd(__FILE__, __LINE__);
|
||||||
|
@ -286,7 +286,7 @@ $obj->infoObj = json_encode($infoObj);
|
||||||
$obj->videos_id = intval($resp);
|
$obj->videos_id = intval($resp);
|
||||||
$obj->video = Video::getVideoLight($obj->videos_id, true);
|
$obj->video = Video::getVideoLight($obj->videos_id, true);
|
||||||
$obj->isNewVideo = $isNewVideo;
|
$obj->isNewVideo = $isNewVideo;
|
||||||
if ($obj->video['status'] == Video::$statusActive) {
|
if ($obj->video['status'] == Video::STATUS_ACTIVE) {
|
||||||
$rowsPath[] = array('line' => __LINE__, 'ElapsedTime' => getElapsedTime());
|
$rowsPath[] = array('line' => __LINE__, 'ElapsedTime' => getElapsedTime());
|
||||||
_error_log('clearFirstPageCache start');
|
_error_log('clearFirstPageCache start');
|
||||||
$obj->clearFirstPageCache = clearFirstPageCache();
|
$obj->clearFirstPageCache = clearFirstPageCache();
|
||||||
|
|
|
@ -45,7 +45,7 @@ TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
|
||||||
foreach ($videos as $key => $value) {
|
foreach ($videos as $key => $value) {
|
||||||
/*
|
/*
|
||||||
$video = new Video('', '', $value['id']);
|
$video = new Video('', '', $value['id']);
|
||||||
$video->setStatus(Video::$statusActive);
|
$video->setStatus(Video::STATUS_ACTIVE);
|
||||||
Video::clearCache($value['id']);continue;
|
Video::clearCache($value['id']);continue;
|
||||||
*/
|
*/
|
||||||
unset($value['password'], $value['recoverPass']);
|
unset($value['password'], $value['recoverPass']);
|
||||||
|
|
|
@ -739,7 +739,7 @@ class AI extends PluginAbstract
|
||||||
|
|
||||||
$video = new Video('', '', $newVideos_id);
|
$video = new Video('', '', $newVideos_id);
|
||||||
if (file_exists($outputFile)) {
|
if (file_exists($outputFile)) {
|
||||||
$video->setAutoStatus(Video::$statusActive);
|
$video->setAutoStatus(Video::STATUS_ACTIVE);
|
||||||
AVideoPlugin::onUploadIsDone($newVideos_id);
|
AVideoPlugin::onUploadIsDone($newVideos_id);
|
||||||
AVideoPlugin::afterNewVideo($newVideos_id);
|
AVideoPlugin::afterNewVideo($newVideos_id);
|
||||||
_error_log('AI:videoCut create file success ' . $outputFile);
|
_error_log('AI:videoCut create file success ' . $outputFile);
|
||||||
|
|
|
@ -35,7 +35,7 @@ foreach ($videos as $value) {
|
||||||
//echo "sites_id is not empty {$value['sites_id']}" . PHP_EOL;
|
//echo "sites_id is not empty {$value['sites_id']}" . PHP_EOL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($value['status'] !== Video::$statusActive) {
|
if ($value['status'] !== Video::STATUS_ACTIVE) {
|
||||||
$countStatusNotActive++;
|
$countStatusNotActive++;
|
||||||
//echo "The video status is not active {$value['status']}" . PHP_EOL;
|
//echo "The video status is not active {$value['status']}" . PHP_EOL;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -27,13 +27,13 @@ $videos = sqlDAL::fetchAllAssoc($res);
|
||||||
$total = count($videos);
|
$total = count($videos);
|
||||||
sqlDAL::close($res);
|
sqlDAL::close($res);
|
||||||
foreach ($videos as $key => $value) {
|
foreach ($videos as $key => $value) {
|
||||||
if ($value['status'] === Video::$statusActive) {
|
if ($value['status'] === Video::STATUS_ACTIVE) {
|
||||||
if (empty($value['sites_id'])) {
|
if (empty($value['sites_id'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = "{$path}{$value['filename']}/";
|
$dir = "{$path}{$value['filename']}/";
|
||||||
|
|
||||||
$dirsize = getDirSize($dir);
|
$dirsize = getDirSize($dir);
|
||||||
if($dirsize<$tenMB){
|
if($dirsize<$tenMB){
|
||||||
echo "Directory too small {$dir} $dirsize<$tenMB ". humanFileSize($dirsize) . PHP_EOL;
|
echo "Directory too small {$dir} $dirsize<$tenMB ". humanFileSize($dirsize) . PHP_EOL;
|
||||||
|
@ -41,7 +41,7 @@ foreach ($videos as $key => $value) {
|
||||||
}else{
|
}else{
|
||||||
echo "Directory size is {$dir} $dirsize ". humanFileSize($dirsize) . PHP_EOL;
|
echo "Directory size is {$dir} $dirsize ". humanFileSize($dirsize) . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filesAffected = CDNStorage::createDummyFiles($value['id']);
|
$filesAffected = CDNStorage::createDummyFiles($value['id']);
|
||||||
if (empty($filesAffected)) {
|
if (empty($filesAffected)) {
|
||||||
echo "{$key}/{$total} ERROR " . PHP_EOL;
|
echo "{$key}/{$total} ERROR " . PHP_EOL;
|
||||||
|
|
|
@ -39,7 +39,7 @@ foreach ($videos as $key => $value) {
|
||||||
$videos_id = $value['id'];
|
$videos_id = $value['id'];
|
||||||
$filename = $value['filename'];
|
$filename = $value['filename'];
|
||||||
|
|
||||||
if ($value['status'] === Video::$statusActive) {
|
if ($value['status'] === Video::STATUS_ACTIVE) {
|
||||||
echo "[videos_id: {$videos_id}] Processing '{$filename}'" . PHP_EOL;
|
echo "[videos_id: {$videos_id}] Processing '{$filename}'" . PHP_EOL;
|
||||||
|
|
||||||
if (empty($value['sites_id'])) {
|
if (empty($value['sites_id'])) {
|
||||||
|
|
|
@ -1,81 +1,81 @@
|
||||||
<?php
|
<?php
|
||||||
$config = dirname(__FILE__) . '/../../../videos/configuration.php';
|
$config = dirname(__FILE__) . '/../../../videos/configuration.php';
|
||||||
require_once $config;
|
require_once $config;
|
||||||
|
|
||||||
if (!isCommandLineInterface()) {
|
if (!isCommandLineInterface()) {
|
||||||
return die('Command Line only');
|
return die('Command Line only');
|
||||||
}
|
}
|
||||||
|
|
||||||
$isCDNEnabled = AVideoPlugin::isEnabledByName('CDN');
|
$isCDNEnabled = AVideoPlugin::isEnabledByName('CDN');
|
||||||
|
|
||||||
if (empty($isCDNEnabled)) {
|
if (empty($isCDNEnabled)) {
|
||||||
return die('Plugin disabled');
|
return die('Plugin disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
set_time_limit(300);
|
set_time_limit(300);
|
||||||
ini_set('max_execution_time', 300);
|
ini_set('max_execution_time', 300);
|
||||||
|
|
||||||
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
|
$global['rowCount'] = $global['limitForUnlimitedVideos'] = 999999;
|
||||||
$path = getVideosDir();
|
$path = getVideosDir();
|
||||||
$total = Video::getTotalVideos("", false, true, true, false, false);
|
$total = Video::getTotalVideos("", false, true, true, false, false);
|
||||||
$videos = Video::getAllVideosLight("", false, true, false);
|
$videos = Video::getAllVideosLight("", false, true, false);
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
$countSiteIdNotEmpty = 0;
|
$countSiteIdNotEmpty = 0;
|
||||||
$countStatusNotActive = 0;
|
$countStatusNotActive = 0;
|
||||||
$countMoved = 0;
|
$countMoved = 0;
|
||||||
|
|
||||||
$videosDir = getVideosDir();
|
$videosDir = getVideosDir();
|
||||||
$errorsFound = [];
|
$errorsFound = [];
|
||||||
foreach ($videos as $value) {
|
foreach ($videos as $value) {
|
||||||
$count++;
|
$count++;
|
||||||
//echo "{$count}/{$total} Checking {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
|
//echo "{$count}/{$total} Checking {$global['webSiteRootURL']}v/{$value['id']} {$value['title']}" . PHP_EOL;
|
||||||
if (empty($value['sites_id'])) {
|
if (empty($value['sites_id'])) {
|
||||||
echo "sites_id is empty {$value['id']} {$value['title']}" . PHP_EOL;
|
echo "sites_id is empty {$value['id']} {$value['title']}" . PHP_EOL;
|
||||||
ob_flush();
|
ob_flush();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($value['status'] !== Video::$statusActive) {
|
if ($value['status'] !== Video::STATUS_ACTIVE) {
|
||||||
$countStatusNotActive++;
|
$countStatusNotActive++;
|
||||||
echo "The video status is not active {$value['status']}" . PHP_EOL;
|
echo "The video status is not active {$value['status']}" . PHP_EOL;
|
||||||
ob_flush();
|
ob_flush();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
echo "Checking {$value['id']} {$value['title']}" . PHP_EOL;
|
echo "Checking {$value['id']} {$value['title']}" . PHP_EOL;
|
||||||
$videos_id = $value['id'];
|
$videos_id = $value['id'];
|
||||||
$list = CDNStorage::getLocalFolder($videos_id);
|
$list = CDNStorage::getLocalFolder($videos_id);
|
||||||
echo "Files found ".count($list) . PHP_EOL;
|
echo "Files found ".count($list) . PHP_EOL;
|
||||||
echo "Errors found ".count($errorsFound) . PHP_EOL;
|
echo "Errors found ".count($errorsFound) . PHP_EOL;
|
||||||
foreach ($list as $value) {
|
foreach ($list as $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
foreach ($value as $value2) {
|
foreach ($value as $value2) {
|
||||||
if (preg_match('/index.m3u8$/', $value2)) {
|
if (preg_match('/index.m3u8$/', $value2)) {
|
||||||
$remote_filename = str_replace($videosDir, '', $value2);
|
$remote_filename = str_replace($videosDir, '', $value2);
|
||||||
echo "Check {$value2}" . PHP_EOL;
|
echo "Check {$value2}" . PHP_EOL;
|
||||||
$content = trim(CDNStorage::file_get_contents($remote_filename));
|
$content = trim(CDNStorage::file_get_contents($remote_filename));
|
||||||
if ($content=='Dummy File') {
|
if ($content=='Dummy File') {
|
||||||
$errorsFound[] = $value2;
|
$errorsFound[] = $value2;
|
||||||
//echo "Found ERROR {$value2}" . PHP_EOL;
|
//echo "Found ERROR {$value2}" . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (preg_match('/index.m3u8$/', $value)) {
|
if (preg_match('/index.m3u8$/', $value)) {
|
||||||
$remote_filename = str_replace($videosDir, '', $value);
|
$remote_filename = str_replace($videosDir, '', $value);
|
||||||
echo "Check {$value}" . PHP_EOL;
|
echo "Check {$value}" . PHP_EOL;
|
||||||
$content = trim(CDNStorage::file_get_contents($remote_filename));
|
$content = trim(CDNStorage::file_get_contents($remote_filename));
|
||||||
if ($content=='Dummy File') {
|
if ($content=='Dummy File') {
|
||||||
$errorsFound[] = $value;
|
$errorsFound[] = $value;
|
||||||
//echo "Found ERROR {$value}" . PHP_EOL;
|
//echo "Found ERROR {$value}" . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($errorsFound as $value) {
|
foreach ($errorsFound as $value) {
|
||||||
echo "*** ERROR {$value}" . PHP_EOL;
|
echo "*** ERROR {$value}" . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo PHP_EOL . " Done! errorsFound = {$errorsFound} " . PHP_EOL;
|
echo PHP_EOL . " Done! errorsFound = {$errorsFound} " . PHP_EOL;
|
||||||
die();
|
die();
|
||||||
|
|
|
@ -42,7 +42,7 @@ foreach ($videos as $value) {
|
||||||
//CDNStorage::createDummyFiles($value['id']);
|
//CDNStorage::createDummyFiles($value['id']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($value['status'] !== Video::$statusActive) {
|
if ($value['status'] !== Video::STATUS_ACTIVE) {
|
||||||
$countStatusNotActive++;
|
$countStatusNotActive++;
|
||||||
//echo "The video status is not active {$value['status']}" . PHP_EOL;
|
//echo "The video status is not active {$value['status']}" . PHP_EOL;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -41,12 +41,12 @@ $videos_dir = getVideosDir();
|
||||||
$rows = [];
|
$rows = [];
|
||||||
|
|
||||||
$transferStatus = [];
|
$transferStatus = [];
|
||||||
$transferStatus[] = Video::$statusActive;
|
$transferStatus[] = Video::STATUS_ACTIVE;
|
||||||
$transferStatus[] = Video::$statusFansOnly;
|
$transferStatus[] = Video::STATUS_FANS_ONLY;
|
||||||
$transferStatus[] = Video::$statusScheduledReleaseDate;
|
$transferStatus[] = Video::STATUS_SCHEDULED_RELEASE_DATE;
|
||||||
if($alsoMoveUnlisted){
|
if($alsoMoveUnlisted){
|
||||||
$transferStatus[] = Video::$statusUnlisted;
|
$transferStatus[] = Video::STATUS_UNLISTED;
|
||||||
$transferStatus[] = Video::$statusUnlistedButSearchable;
|
$transferStatus[] = Video::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$statusSkipped = array();
|
$statusSkipped = array();
|
||||||
|
|
|
@ -259,11 +259,11 @@ class CustomizeAdvanced extends PluginAbstract {
|
||||||
$dbObject = PluginAbstract::getObjectDataFromDatabase($this->getUUID());
|
$dbObject = PluginAbstract::getObjectDataFromDatabase($this->getUUID());
|
||||||
|
|
||||||
if (!empty($dbObject->makeVideosInactiveAfterEncode)) {
|
if (!empty($dbObject->makeVideosInactiveAfterEncode)) {
|
||||||
$o->value = Video::$statusInactive;
|
$o->value = Video::STATUS_INACTIVE;
|
||||||
} elseif (!empty($dbObject->makeVideosUnlistedAfterEncode)) {
|
} elseif (!empty($dbObject->makeVideosUnlistedAfterEncode)) {
|
||||||
$o->value = Video::$statusUnlisted;
|
$o->value = Video::STATUS_UNLISTED;
|
||||||
}else{
|
}else{
|
||||||
$o->value = Video::$statusActive;
|
$o->value = Video::STATUS_ACTIVE;
|
||||||
}
|
}
|
||||||
$obj->defaultVideoStatus = $o;
|
$obj->defaultVideoStatus = $o;
|
||||||
self::addDataObjectHelper('defaultVideoStatus', 'Default video status', 'When you submit a video that will be the default status');
|
self::addDataObjectHelper('defaultVideoStatus', 'Default video status', 'When you submit a video that will be the default status');
|
||||||
|
@ -840,11 +840,11 @@ Disallow: *action=tagsearch*
|
||||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||||
sqlDAL::close($res);
|
sqlDAL::close($res);
|
||||||
$transferStatus = [];
|
$transferStatus = [];
|
||||||
$transferStatus[] = Video::$statusActive;
|
$transferStatus[] = Video::STATUS_ACTIVE;
|
||||||
$transferStatus[] = Video::$statusFansOnly;
|
$transferStatus[] = Video::STATUS_FANS_ONLY;
|
||||||
$transferStatus[] = Video::$statusScheduledReleaseDate;
|
$transferStatus[] = Video::STATUS_SCHEDULED_RELEASE_DATE;
|
||||||
$transferStatus[] = Video::$statusUnlisted;
|
$transferStatus[] = Video::STATUS_UNLISTED;
|
||||||
$transferStatus[] = Video::$statusUnlistedButSearchable;
|
$transferStatus[] = Video::STATUS_UNLISTED_BUT_SEARCHABLE;
|
||||||
|
|
||||||
if ($res != false) {
|
if ($res != false) {
|
||||||
foreach ($fullData as $key => $row) {
|
foreach ($fullData as $key => $row) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
$video->setVideo_password($_REQUEST['video_password']);
|
$video->setVideo_password($_REQUEST['video_password']);
|
||||||
}
|
}
|
||||||
if ($type == "image") {
|
if ($type == "image") {
|
||||||
$video->setStatus(Video::$statusActive);
|
$video->setStatus(Video::STATUS_ACTIVE);
|
||||||
make_path($paths['path']);
|
make_path($paths['path']);
|
||||||
$file = "{$paths['path']}{$paths['filename']}.{$extension}";
|
$file = "{$paths['path']}{$paths['filename']}.{$extension}";
|
||||||
if (!move_uploaded_file($_FILES['upl']['tmp_name'], $file)) {
|
if (!move_uploaded_file($_FILES['upl']['tmp_name'], $file)) {
|
||||||
|
@ -112,7 +112,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
$object->msg = "your image was posted";
|
$object->msg = "your image was posted";
|
||||||
$object->videos_id = $video->save();
|
$object->videos_id = $video->save();
|
||||||
} else {
|
} else {
|
||||||
$video->setStatus(Video::$statusEncoding);
|
$video->setStatus(Video::STATUS_ENCODING);
|
||||||
|
|
||||||
if (!move_uploaded_file($_FILES['upl']['tmp_name'], Video::getStoragePath() . "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'] . ", " . Video::getStoragePath() . "original_" . $filename . ")";
|
$object->msg = "Error on move_uploaded_file(" . $_FILES['upl']['tmp_name'] . ", " . Video::getStoragePath() . "original_" . $filename . ")";
|
||||||
|
|
|
@ -42,7 +42,7 @@ $videos_id = intval(@$_REQUEST['videos_id']);
|
||||||
$_GET['rowCount'] = $_REQUEST['rowCount'] = 500;
|
$_GET['rowCount'] = $_REQUEST['rowCount'] = 500;
|
||||||
$videos = Video::getAllActiveEPGs();
|
$videos = Video::getAllActiveEPGs();
|
||||||
foreach ($videos as $video) {
|
foreach ($videos as $video) {
|
||||||
if ($video['status'] !== Video::$statusActive || !isValidURL($video['epg_link'])) {
|
if ($video['status'] !== Video::STATUS_ACTIVE || !isValidURL($video['epg_link'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//if($video['id']=='3847'){ var_dump($video['status']);exit;}
|
//if($video['id']=='3847'){ var_dump($video['status']);exit;}
|
||||||
|
@ -312,7 +312,7 @@ function createEPG($channel) {
|
||||||
if($_stopTime<$nowTime){
|
if($_stopTime<$nowTime){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$minutes = getDurationInMinutes($program['start'], $program['stop']);
|
$minutes = getDurationInMinutes($program['start'], $program['stop']);
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -411,7 +411,7 @@ class Scheduler extends PluginAbstract
|
||||||
$e->setExecuted($videos_id);
|
$e->setExecuted($videos_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$status = $video->setStatus(Video::$statusActive);
|
//$status = $video->setStatus(Video::STATUS_ACTIVE);
|
||||||
$status = $video->setStatus($advancedCustom->defaultVideoStatus->value);
|
$status = $video->setStatus($advancedCustom->defaultVideoStatus->value);
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
|
@ -456,11 +456,11 @@ class Scheduler extends PluginAbstract
|
||||||
$video = new Video('', '', $videos_id);
|
$video = new Video('', '', $videos_id);
|
||||||
if ($releaseTime > time()) {
|
if ($releaseTime > time()) {
|
||||||
$releaseDateTime = date('Y-m-d H:i:s', $releaseTime);
|
$releaseDateTime = date('Y-m-d H:i:s', $releaseTime);
|
||||||
$video->setStatus(Video::$statusScheduledReleaseDate);
|
$video->setStatus(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||||
self::setReleaseDateTime($videos_id, $releaseDateTime, $releaseTime);
|
self::setReleaseDateTime($videos_id, $releaseDateTime, $releaseTime);
|
||||||
self::addVideoToRelease($releaseDateTime, $releaseTime, $videos_id);
|
self::addVideoToRelease($releaseDateTime, $releaseTime, $videos_id);
|
||||||
return true;
|
return true;
|
||||||
} else if ($video->getStatus() == Video::$statusScheduledReleaseDate) {
|
} else if ($video->getStatus() == Video::STATUS_SCHEDULED_RELEASE_DATE) {
|
||||||
self::releaseVideosNow($videos_id);
|
self::releaseVideosNow($videos_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -562,7 +562,7 @@ class Scheduler extends PluginAbstract
|
||||||
|
|
||||||
function executeEveryMinute()
|
function executeEveryMinute()
|
||||||
{
|
{
|
||||||
$rows = Video::getAllVideosLight(Video::$statusScheduledReleaseDate);
|
$rows = Video::getAllVideosLight(Video::STATUS_SCHEDULED_RELEASE_DATE);
|
||||||
foreach ($rows as $key => $value) {
|
foreach ($rows as $key => $value) {
|
||||||
$releaseDate = self::getReleaseDateTime($value['id']);
|
$releaseDate = self::getReleaseDateTime($value['id']);
|
||||||
if (empty($releaseDate) || strtotime($releaseDate) <= time()) {
|
if (empty($releaseDate) || strtotime($releaseDate) <= time()) {
|
||||||
|
|
|
@ -458,10 +458,10 @@ if (empty($advancedCustom)) {
|
||||||
$statusSearchFilter = array();
|
$statusSearchFilter = array();
|
||||||
}
|
}
|
||||||
if (AVideoPlugin::isEnabled('FansSubscriptions')) {
|
if (AVideoPlugin::isEnabled('FansSubscriptions')) {
|
||||||
$statusSearchFilter[] = Video::$statusFansOnly;
|
$statusSearchFilter[] = Video::STATUS_FANS_ONLY;
|
||||||
}
|
}
|
||||||
if (AVideoPlugin::isEnabled('SendRecordedToEncoder')) {
|
if (AVideoPlugin::isEnabled('SendRecordedToEncoder')) {
|
||||||
$statusSearchFilter[] = Video::$statusRecording;
|
$statusSearchFilter[] = Video::STATUS_RECORDING;
|
||||||
}
|
}
|
||||||
foreach (Video::$statusDesc as $key => $value) {
|
foreach (Video::$statusDesc as $key => $value) {
|
||||||
if (!in_array($key, $statusSearchFilter)) {
|
if (!in_array($key, $statusSearchFilter)) {
|
||||||
|
@ -1277,7 +1277,7 @@ if (empty($advancedCustom->disableHTMLDescription)) {
|
||||||
$('#videoStartSeconds').val('00:00:00');
|
$('#videoStartSeconds').val('00:00:00');
|
||||||
$('#videoSkipIntroSecond').val('00:00:00');
|
$('#videoSkipIntroSecond').val('00:00:00');
|
||||||
$('#inputVideoPassword').val("");
|
$('#inputVideoPassword').val("");
|
||||||
$('#videoStatus').val('<?php echo Video::$statusDraft; ?>');
|
$('#videoStatus').val('<?php echo Video::STATUS_DRAFT; ?>');
|
||||||
$('#inputCleanTitle').val("");
|
$('#inputCleanTitle').val("");
|
||||||
$('#created').val("");
|
$('#created').val("");
|
||||||
$('#inputDescription').val("");
|
$('#inputDescription').val("");
|
||||||
|
|
|
@ -46,7 +46,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
$filename = $video->getFilename();
|
$filename = $video->getFilename();
|
||||||
if ($video->getTitle() === "Video automatically booked") {
|
if ($video->getTitle() === "Video automatically booked") {
|
||||||
$video->setTitle($title);
|
$video->setTitle($title);
|
||||||
$video->setStatus(Video::$statusInactive);
|
$video->setStatus(Video::STATUS_INACTIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//var_dump($videos_id, $_FILES['upl']['name'], $title, $video->getTitle());exit;
|
//var_dump($videos_id, $_FILES['upl']['name'], $title, $video->getTitle());exit;
|
||||||
|
@ -101,7 +101,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
$video->setType("zip", true);
|
$video->setType("zip", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$video->setAutoStatus(Video::$statusInactive);
|
$video->setAutoStatus(Video::STATUS_INACTIVE);
|
||||||
|
|
||||||
$id = $video->save();
|
$id = $video->save();
|
||||||
if ($id) {
|
if ($id) {
|
||||||
|
@ -113,7 +113,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
$tmp_name = $_FILES['upl']['tmp_name'];
|
$tmp_name = $_FILES['upl']['tmp_name'];
|
||||||
$filenameMP4 = $filename . "." . $extension;
|
$filenameMP4 = $filename . "." . $extension;
|
||||||
decideMoveUploadedToVideos($tmp_name, $filenameMP4, $video->getType());
|
decideMoveUploadedToVideos($tmp_name, $filenameMP4, $video->getType());
|
||||||
|
|
||||||
$obj->title = $video->getTitle();
|
$obj->title = $video->getTitle();
|
||||||
$obj->error = false;
|
$obj->error = false;
|
||||||
$obj->filename = $filename;
|
$obj->filename = $filename;
|
||||||
|
@ -139,7 +139,7 @@ if (isset($_FILES['upl']) && $_FILES['upl']['error'] == 0) {
|
||||||
|
|
||||||
if (!empty($_FILES['upl']['tmp_name'])) {
|
if (!empty($_FILES['upl']['tmp_name'])) {
|
||||||
$obj->lines[] = __LINE__;
|
$obj->lines[] = __LINE__;
|
||||||
$video->setAutoStatus(Video::$statusActive);
|
$video->setAutoStatus(Video::STATUS_ACTIVE);
|
||||||
AVideoPlugin::onUploadIsDone($obj->videos_id);
|
AVideoPlugin::onUploadIsDone($obj->videos_id);
|
||||||
AVideoPlugin::afterNewVideo($obj->videos_id);
|
AVideoPlugin::afterNewVideo($obj->videos_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,9 +344,9 @@ TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
|
||||||
if (empty($video)) {
|
if (empty($video)) {
|
||||||
if (!empty($_GET['v'])) {
|
if (!empty($_GET['v'])) {
|
||||||
$vid = new Video('', '', $_GET['v']);
|
$vid = new Video('', '', $_GET['v']);
|
||||||
if ($vid->getStatus() === Video::$statusBrokenMissingFiles) {
|
if ($vid->getStatus() === Video::STATUS_BROKEN_MISSING_FILES) {
|
||||||
if (!Video::isMediaFileMissing($vid->getFilename())) {
|
if (!Video::isMediaFileMissing($vid->getFilename())) {
|
||||||
$vid->setStatus(Video::$statusActive);
|
$vid->setStatus(Video::STATUS_ACTIVE);
|
||||||
$vid->save();
|
$vid->save();
|
||||||
_error_log('Missing files recovered ' . $_GET['v']);
|
_error_log('Missing files recovered ' . $_GET['v']);
|
||||||
} else {
|
} else {
|
||||||
|
@ -359,7 +359,7 @@ if (empty($video)) {
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
} else if ($vid->getStatus() === Video::$statusUnpublished) {
|
} else if ($vid->getStatus() === Video::STATUS_UNPUBLISHED) {
|
||||||
$msg = 'This video is currently unpublished. Please contact an administrator to review and approve it for publication. Thank you for your patience and understanding.';
|
$msg = 'This video is currently unpublished. Please contact an administrator to review and approve it for publication. Thank you for your patience and understanding.';
|
||||||
videoNotFound($msg);
|
videoNotFound($msg);
|
||||||
exit;
|
exit;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue