mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Update
This commit is contained in:
parent
6c032f5228
commit
4e2a43cdfc
6 changed files with 21 additions and 13 deletions
|
@ -7326,6 +7326,9 @@ function convertVideoToMP3FileIfNotExists($videos_id)
|
||||||
|
|
||||||
$paths = Video::getPaths($video['filename']);
|
$paths = Video::getPaths($video['filename']);
|
||||||
$mp3File = "{$paths['path']}{$video['filename']}.mp3";
|
$mp3File = "{$paths['path']}{$video['filename']}.mp3";
|
||||||
|
if (file_exists($mp3File) && filesize($mp3File)<100) {
|
||||||
|
unlink($mp3File);
|
||||||
|
}
|
||||||
if (!file_exists($mp3File)) {
|
if (!file_exists($mp3File)) {
|
||||||
$sources = getVideosURLOnly($video['filename'], false);
|
$sources = getVideosURLOnly($video['filename'], false);
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,13 @@ if (empty($plugin)) {
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PlayLists::canAddVideoOnPlaylist($_POST['videos_id'])) {
|
if (!PlayLists::canAddVideoOnPlaylist($_REQUEST['videos_id'])) {
|
||||||
$obj->msg = "You can not add this video on playlist";
|
$obj->msg = "You can not add this video on playlist";
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
$playList = new PlayList($_POST['playlists_id']);
|
$playList = new PlayList($_REQUEST['playlists_id']);
|
||||||
if (empty($playList) || empty($_POST['videos_id'])) {
|
if (empty($playList) || empty($_REQUEST['videos_id'])) {
|
||||||
$obj->msg = __("Permission denied");
|
$obj->msg = __("Permission denied");
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,9 @@ if(!PlayLists::canManageAllPlaylists() && User::getId() !== $playList->getUsers_
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->error = false;
|
$obj->error = false;
|
||||||
$obj->status = $playList->addVideo($_POST['videos_id'], $_POST['add']);
|
$obj->status = $playList->addVideo($_REQUEST['videos_id'], $_REQUEST['add']);
|
||||||
$obj->users_id = $playList->getUsers_id();
|
$obj->users_id = $playList->getUsers_id();
|
||||||
|
$obj->id = $playList->getId();
|
||||||
|
|
||||||
//log_error("videos id: ".$_POST['videos_id']." playlist_id: ".$_POST['playlists_id']);
|
//log_error("videos id: ".$_REQUEST['videos_id']." playlist_id: ".$_REQUEST['playlists_id']);
|
||||||
die(json_encode($obj));
|
die(json_encode($obj));
|
||||||
|
|
|
@ -924,11 +924,12 @@ class PlayList extends ObjectYPT
|
||||||
return sqlDAL::writeSql($sql);
|
return sqlDAL::writeSql($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getNextOrder($playlists_id, $videos_id){
|
static function getNextOrder($playlists_id){
|
||||||
$sql = 'SELECT MAX(`order`) AS max_order
|
$sql = 'SELECT MAX(`order`) AS max_order
|
||||||
FROM playlists_has_videos
|
FROM playlists_has_videos
|
||||||
WHERE playlists_id = ? AND videos_id = ?';
|
WHERE playlists_id = ? ';
|
||||||
$res = sqlDAL::readSql($sql, 'ii', array($playlists_id, $videos_id));
|
//_error_log("playlistSort getNextOrder {$sql} " . json_encode(array($playlists_id)));
|
||||||
|
$res = sqlDAL::readSql($sql, 'i', array($playlists_id));
|
||||||
$row = sqlDAL::fetchAssoc($res);
|
$row = sqlDAL::fetchAssoc($res);
|
||||||
sqlDAL::close($res);
|
sqlDAL::close($res);
|
||||||
$max_order = 0;
|
$max_order = 0;
|
||||||
|
@ -960,7 +961,7 @@ class PlayList extends ObjectYPT
|
||||||
} else {
|
} else {
|
||||||
$this->addVideo($videos_id, false, 0, false);
|
$this->addVideo($videos_id, false, 0, false);
|
||||||
if(empty($order)){
|
if(empty($order)){
|
||||||
$order = self::getNextOrder($this->id, $videos_id);
|
$order = self::getNextOrder($this->id);
|
||||||
}
|
}
|
||||||
$sql = "INSERT INTO playlists_has_videos ( playlists_id, videos_id , `order`) VALUES (?, ?, ?) ";
|
$sql = "INSERT INTO playlists_has_videos ( playlists_id, videos_id , `order`) VALUES (?, ?, ?) ";
|
||||||
$formats = "iii";
|
$formats = "iii";
|
||||||
|
@ -968,6 +969,7 @@ class PlayList extends ObjectYPT
|
||||||
$values[] = $videos_id;
|
$values[] = $videos_id;
|
||||||
$values[] = $order;
|
$values[] = $order;
|
||||||
}
|
}
|
||||||
|
//_error_log("playlistSort addVideo {$sql} " . json_encode($values));
|
||||||
//_error_log('playlistSort addVideo line=' . __LINE__);
|
//_error_log('playlistSort addVideo line=' . __LINE__);
|
||||||
$result = sqlDAL::writeSql($sql, $formats, $values);
|
$result = sqlDAL::writeSql($sql, $formats, $values);
|
||||||
if ($_deleteCache === true) {
|
if ($_deleteCache === true) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ class AI extends PluginAbstract {
|
||||||
static $typeTranslation = 'translation';
|
static $typeTranslation = 'translation';
|
||||||
static $typeTranscription = 'transcription';
|
static $typeTranscription = 'transcription';
|
||||||
static $typeBasic = 'basic';
|
static $typeBasic = 'basic';
|
||||||
|
static $typeShorts = 'shorts';
|
||||||
|
|
||||||
static $languages = [
|
static $languages = [
|
||||||
'en' => 'English',
|
'en' => 'English',
|
||||||
|
|
|
@ -2226,6 +2226,7 @@ class API extends PluginAbstract
|
||||||
$row[$key]['videos'][$key2] = cleanUpRowFromDatabase($row[$key]['videos'][$key2]);
|
$row[$key]['videos'][$key2] = cleanUpRowFromDatabase($row[$key]['videos'][$key2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
header('Content-Type: application/json');
|
||||||
echo json_encode($row);
|
echo json_encode($row);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -2269,9 +2270,10 @@ class API extends PluginAbstract
|
||||||
if (!User::isLogged()) {
|
if (!User::isLogged()) {
|
||||||
return new ApiObject("Wrong user or password");
|
return new ApiObject("Wrong user or password");
|
||||||
}
|
}
|
||||||
$_POST['videos_id'] = $parameters['videos_id'];
|
$_REQUEST['videos_id'] = $parameters['videos_id'];
|
||||||
$_POST['add'] = $add;
|
$_REQUEST['add'] = $add;
|
||||||
$_POST['playlists_id'] = PlayLists::getFavoriteIdFromUser(User::getId());
|
$_REQUEST['playlists_id'] = PlayLists::getFavoriteIdFromUser(User::getId());
|
||||||
|
header('Content-Type: application/json');
|
||||||
require_once $global['systemRootPath'] . 'objects/playListAddVideo.json.php';
|
require_once $global['systemRootPath'] . 'objects/playListAddVideo.json.php';
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ require_once dirname(__FILE__) . '/../../videos/configuration.php';
|
||||||
$title = array('Buy');
|
$title = array('Buy');
|
||||||
$global['doNotLoadPlayer'] = 1;
|
$global['doNotLoadPlayer'] = 1;
|
||||||
|
|
||||||
|
|
||||||
// get groups id
|
// get groups id
|
||||||
// get redirect URL
|
// get redirect URL
|
||||||
// get URL parameters
|
// get URL parameters
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue