mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 17:59:55 +02:00
Update
This commit is contained in:
parent
905d3650ae
commit
a030cf99a2
1 changed files with 45 additions and 19 deletions
|
@ -972,18 +972,14 @@ class API extends PluginAbstract
|
|||
require_once $global['systemRootPath'] . 'objects/subscribe.php';
|
||||
$rows[$key]['isSubscribed'] = Subscribe::isSubscribed($rows[$key]['users_id']);
|
||||
}
|
||||
$rows[$key]['subtitles_available'] = false;
|
||||
$rows[$key]['subtitles'] = [];
|
||||
if ($SubtitleSwitcher) {
|
||||
$subtitles = getVTTTracks($value['filename'], true);
|
||||
$rows[$key]['subtitles_available'] = !empty($subtitles);
|
||||
if(empty($SubtitleSwitcher->disableOnAPI)){
|
||||
$rows[$key]['subtitles'] = $subtitles;
|
||||
foreach ($rows[$key]['subtitles'] as $key2 => $value) {
|
||||
$rows[$key]['subtitlesSRT'][] = convertSRTTrack($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sub = self::getSubtitle($filename);
|
||||
|
||||
$rows[$key]['subtitles_available'] = $sub['subtitles_available'];
|
||||
$rows[$key]['subtitles'] = $sub['subtitles'];
|
||||
$rows[$key]['subtitlesSRT'] = $sub['subtitlesSRT'];
|
||||
|
||||
require_once $global['systemRootPath'] . 'objects/comment.php';
|
||||
require_once $global['systemRootPath'] . 'objects/subscribe.php';
|
||||
unset($_POST['sort']);
|
||||
|
@ -1020,6 +1016,13 @@ class API extends PluginAbstract
|
|||
$rows[$key]['relatedVideos'] = Video::getRelatedMovies($rows[$key]['id']);
|
||||
foreach ($rows[$key]['relatedVideos'] as $key2 => $value2) {
|
||||
$rows[$key]['relatedVideos'][$key2]['tags'] = Video::getTags($value2['id']);
|
||||
|
||||
$sub = self::getSubtitle($filename);
|
||||
|
||||
$rows[$key]['relatedVideos'][$key2]['subtitles_available'] = $sub['subtitles_available'];
|
||||
$rows[$key]['relatedVideos'][$key2]['subtitles'] = $sub['subtitles'];
|
||||
$rows[$key]['relatedVideos'][$key2]['subtitlesSRT'] = $sub['subtitlesSRT'];
|
||||
|
||||
if (AVideoPlugin::isEnabledByName("VideoTags")) {
|
||||
$rows[$key]['relatedVideos'][$key2]['videoTags'] = Tags::getAllFromVideosId($value2['id']);
|
||||
$rows[$key]['relatedVideos'][$key2]['videoTagsObject'] = Tags::getObjectFromVideosId($value2['id']);
|
||||
|
@ -1064,6 +1067,29 @@ class API extends PluginAbstract
|
|||
return new ApiObject("", false, $obj);
|
||||
}
|
||||
|
||||
private static function getSubtitle($filename)
|
||||
{
|
||||
global $_SubtitleSwitcher;
|
||||
if (!isset($_SubtitleSwitcher)) {
|
||||
$_SubtitleSwitcher = AVideoPlugin::getDataObjectIfEnabled("SubtitleSwitcher");
|
||||
}
|
||||
$row = array();
|
||||
$row['subtitles_available'] = false;
|
||||
$row['subtitles'] = [];
|
||||
$row['subtitlesSRT'] = [];
|
||||
if ($_SubtitleSwitcher) {
|
||||
$subtitles = getVTTTracks($filename, true);
|
||||
$row['subtitles_available'] = !empty($subtitles);
|
||||
if (empty($_SubtitleSwitcher->disableOnAPI)) {
|
||||
$row['subtitles'] = $subtitles;
|
||||
foreach ($row['subtitles'] as $key2 => $value) {
|
||||
$row['subtitlesSRT'][] = convertSRTTrack($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $parameters
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue