mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
parent
0d29df8c7c
commit
e916a87c0f
5 changed files with 37 additions and 10 deletions
|
@ -37,6 +37,7 @@ class BulkEmbed extends PluginAbstract {
|
|||
|
||||
$obj->API_KEY = "AIzaSyCIqxE86BawU33Um2HEGtX4PcrUWeCh_6o";
|
||||
$obj->onlyAdminCanBulkEmbed = true;
|
||||
$obj->useOriginalYoutubeDate = true;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ function ISO8601ToSeconds($ISO8601)
|
|||
$minutes = intval(@$minutes);
|
||||
$seconds = intval(@$seconds);
|
||||
|
||||
$toltalSeconds = ($hours * 60 * 60) + ($minutes * 60) + $seconds;
|
||||
$totalSeconds = ($hours * 60 * 60) + ($minutes * 60) + $seconds;
|
||||
|
||||
return $toltalSeconds;
|
||||
return $totalSeconds;
|
||||
}
|
||||
|
||||
function ISO8601ToDuration($ISO8601)
|
||||
|
@ -48,7 +48,6 @@ $obj->error = true;
|
|||
$obj->msg = array();
|
||||
$obj->playListId = 0;
|
||||
|
||||
|
||||
$objo = AVideoPlugin::getObjectDataIfEnabled('BulkEmbed');
|
||||
if (empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())) {
|
||||
$obj->msg[] = __("Permission denied");
|
||||
|
@ -82,6 +81,12 @@ if (empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())) {
|
|||
$videos->setDescription($value['description']);
|
||||
$videos->setClean_title($value['title']);
|
||||
$videos->setDuration(ISO8601ToDuration($value['duration']));
|
||||
|
||||
// Set the original video date if available in the form data
|
||||
if (!empty($value['date']) && $objo->useOriginalYoutubeDate) {
|
||||
$videos->setCreated($value['date']); // Set the original creation date of the video
|
||||
}
|
||||
|
||||
$poster = Video::getPathToFile("{$paths['filename']}.jpg");
|
||||
$thumbs = $value['thumbs'];
|
||||
if (!empty($thumbs)) {
|
||||
|
@ -89,7 +94,7 @@ if (empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())) {
|
|||
if (!empty($contentThumbs)) {
|
||||
make_path($poster);
|
||||
$bytes = file_put_contents($poster, $contentThumbs);
|
||||
_error_log("thumbs={$thumbs} poster=$poster bytes=$bytes strlen=".strlen($contentThumbs));
|
||||
_error_log("thumbs={$thumbs} poster=$poster bytes=$bytes strlen=" . strlen($contentThumbs));
|
||||
} else {
|
||||
_error_log("ERROR thumbs={$thumbs} poster=$poster");
|
||||
}
|
||||
|
@ -119,7 +124,7 @@ if (empty($objo) || ($objo->onlyAdminCanBulkEmbed && !User::isAdmin())) {
|
|||
|
||||
AVideoPlugin::saveVideosAddNew($_POST, $resp);
|
||||
|
||||
$obj->msg[] = Video::getVideoLight($resp);
|
||||
$obj->msg[] = array('video'=>Video::getVideoLight($resp), 'value'=>$value, 'videos_id'=>$resp);
|
||||
}
|
||||
|
||||
$obj->error = false;
|
||||
|
|
|
@ -165,8 +165,9 @@ $_page = new Page(array('Search'));
|
|||
item.title = data.items[0].snippet.title;
|
||||
item.description = data.items[0].snippet.description;
|
||||
item.duration = data.items[0].contentDetails.duration;
|
||||
console.log(data.items[0].snippet);
|
||||
item.thumbs = data.items[0].snippet.thumbnails.high.url;
|
||||
item.date = data.items[0].snippet.publishedAt;
|
||||
console.log(data.items[0].snippet, item);
|
||||
itemsToSave.push(item);
|
||||
}
|
||||
});
|
||||
|
@ -180,9 +181,9 @@ $_page = new Page(array('Search'));
|
|||
type: 'post',
|
||||
success: function(response) {
|
||||
if (!response.error) {
|
||||
avideoAlert("<?php echo __("Congratulations!"); ?>", "<?php echo __("Your videos have been saved!"); ?>", "success");
|
||||
avideoAlertSuccess(__("Your videos have been saved!"));
|
||||
} else {
|
||||
avideoAlert("<?php echo __("Sorry!"); ?>", response.msg.join("<br>"), "error");
|
||||
avideoAlertError(response.msg.join("<br>"));
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
|
@ -417,7 +418,7 @@ $_page = new Page(array('Search'));
|
|||
'<img src="' + thumb + '">' +
|
||||
'</div>' +
|
||||
'<div class="list-right">' +
|
||||
'<h3><input type="checkbox" value="' + videoID + '" name="videoCheckbox"><a target="_blank" href="https://youtube.com/embed/' + videoID + '?rel=0">' + title + '</a></h3>' +
|
||||
'<h3><input type="checkbox" value="' + videoID + '" name="videoCheckbox"> <a target="_blank" href="https://youtube.com/embed/' + videoID + '?rel=0">' + title + '</a></h3>' +
|
||||
'<small>By <span class="cTitle">' + channelTitle + '</span> on ' + videoDate + '</small>' +
|
||||
'<p>' + description + '</p>' +
|
||||
'</div>' +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue