mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 18:29:39 +02:00
Some improvements to combine sites
This commit is contained in:
parent
2b62335d5e
commit
f5d738c7ec
5 changed files with 119 additions and 19 deletions
|
@ -3017,3 +3017,9 @@ function isToShowDuration($type){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _dieAndLogObject($obj, $prefix=""){
|
||||||
|
$objString = json_encode($obj);
|
||||||
|
_error_log($prefix.$objString);
|
||||||
|
die($objString);
|
||||||
|
}
|
|
@ -300,7 +300,6 @@ class API extends PluginAbstract {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type $parameters
|
* @param type $parameters
|
||||||
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||||
|
@ -358,6 +357,79 @@ class API extends PluginAbstract {
|
||||||
return new ApiObject("", false, $obj);
|
return new ApiObject("", false, $obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type $parameters
|
||||||
|
* Return all channels on this site
|
||||||
|
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||||
|
* @return \ApiObject
|
||||||
|
*/
|
||||||
|
public function get_api_channels($parameters) {
|
||||||
|
global $global;
|
||||||
|
require_once $global['systemRootPath'] . 'objects/Channel.php';
|
||||||
|
$channels = Channel::getChannels();
|
||||||
|
$list = array();
|
||||||
|
foreach ($channels as $value) {
|
||||||
|
$obj = new stdClass();
|
||||||
|
$obj->id = $value['id'];
|
||||||
|
$obj->photo = User::getPhoto($value['id']);
|
||||||
|
$obj->channelLink = User::getChannelLink($value['id']);
|
||||||
|
$obj->name = User::getNameIdentificationById($value['id']);
|
||||||
|
$list[] = $obj;
|
||||||
|
}
|
||||||
|
return new ApiObject("", false, $list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type $parameters
|
||||||
|
* Return all Programs (Playlists) on this site
|
||||||
|
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||||
|
* @return \ApiObject
|
||||||
|
*/
|
||||||
|
public function get_api_programs($parameters) {
|
||||||
|
global $global;
|
||||||
|
require_once $global['systemRootPath'] . 'objects/category.php';
|
||||||
|
$playlists = PlayList::getAll();
|
||||||
|
foreach ($playlists as $value) {
|
||||||
|
$videosArrayId = PlayList::getVideosIdFromPlaylist($value['id']);
|
||||||
|
if (empty($videosArrayId) || $value['status'] == "favorite" || $value['status'] == "watch_later") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$obj = new stdClass();
|
||||||
|
$obj->id = $value['id'];
|
||||||
|
$obj->photo = User::getPhoto($value['users_id']);
|
||||||
|
$obj->channelLink = User::getChannelLink($value['users_id']);
|
||||||
|
$obj->username = User::getNameIdentificationById($value['users_id']);
|
||||||
|
$obj->name = $value['name'];
|
||||||
|
$obj->link = PlayLists::getLink($value['id']);
|
||||||
|
$list[] = $obj;
|
||||||
|
}
|
||||||
|
return new ApiObject("", false, $list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type $parameters
|
||||||
|
* Return all categories on this site
|
||||||
|
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}
|
||||||
|
* @return \ApiObject
|
||||||
|
*/
|
||||||
|
public function get_api_categories($parameters) {
|
||||||
|
global $global;
|
||||||
|
require_once $global['systemRootPath'] . 'objects/category.php';
|
||||||
|
$categories = Category::getAllCategories();
|
||||||
|
array_multisort(array_column($categories, 'hierarchyAndName'), SORT_ASC, $categories);
|
||||||
|
$list = array();
|
||||||
|
foreach ($categories as $value) {
|
||||||
|
$obj = new stdClass();
|
||||||
|
$obj->id = $value['id'];
|
||||||
|
$obj->iconClass = $value['iconClass'];
|
||||||
|
$obj->hierarchyAndName = $value['hierarchyAndName'];
|
||||||
|
$obj->name = $value['name'];
|
||||||
|
$obj->fullTotal = $value['fullTotal'];
|
||||||
|
$obj->total = $value['total'];
|
||||||
|
$list[] = $obj;
|
||||||
|
}
|
||||||
|
return new ApiObject("", false, $list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type $parameters
|
* @param type $parameters
|
||||||
|
|
22
plugin/API/status.json.php
Normal file
22
plugin/API/status.json.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
$configFile = '../../videos/configuration.php';
|
||||||
|
if (!file_exists($configFile)) {
|
||||||
|
list($scriptPath) = get_included_files();
|
||||||
|
$path = pathinfo($scriptPath);
|
||||||
|
$configFile = $path['dirname'] . "/" . $configFile;
|
||||||
|
}
|
||||||
|
require_once $configFile;
|
||||||
|
require_once $global['systemRootPath'].'plugin/API/API.php';
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$plugin = AVideoPlugin::loadPluginIfEnabled("API");
|
||||||
|
$objData = AVideoPlugin::getObjectDataIfEnabled("API");
|
||||||
|
|
||||||
|
if(empty($plugin)){
|
||||||
|
$obj = new ApiObject("API Plugin disabled");
|
||||||
|
}else{
|
||||||
|
$obj = new ApiObject("API Plugin enabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
die(json_encode($obj));
|
|
@ -138,7 +138,7 @@ if (!empty($videos)) {
|
||||||
<?php echo __("Make it public"); ?>
|
<?php echo __("Make it public"); ?>
|
||||||
<div class="material-switch pull-right">
|
<div class="material-switch pull-right">
|
||||||
<input id="publicPlayList<?php echo $video['id']; ?>" name="publicPlayList" type="checkbox" checked="checked"/>
|
<input id="publicPlayList<?php echo $video['id']; ?>" name="publicPlayList" type="checkbox" checked="checked"/>
|
||||||
<label for="publicPlayList" class="label-success"></label>
|
<label for="publicPlayList<?php echo $video['id']; ?>" class="label-success"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
@ -259,8 +259,8 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
changingVideoFloat = 1;
|
changingVideoFloat = 1;
|
||||||
var s = $(window).scrollTop();
|
var s = $(window).scrollTop();
|
||||||
console.log("$(window).scrollTop()= " + s);
|
//console.log("$(window).scrollTop()= " + s);
|
||||||
console.log("mainVideoHeight = $('#videoContainer').innerHeight()= " + mainVideoHeight);
|
//console.log("mainVideoHeight = $('#videoContainer').innerHeight()= " + mainVideoHeight);
|
||||||
if (s > mainVideoHeight) {
|
if (s > mainVideoHeight) {
|
||||||
setFloatVideo();
|
setFloatVideo();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue