1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00

Implement playlist redirection and improve video loading logs in modeYoutube.php

This commit is contained in:
Daniel Neto 2025-07-08 10:40:51 -03:00
parent be5efab9af
commit 0e0ee74f10

View file

@ -91,6 +91,17 @@ if (!empty($evideo)) {
$playListData = $plp->getPlayListData(); $playListData = $plp->getPlayListData();
//var_dump($playListData);exit; //var_dump($playListData);exit;
if (empty($playListData)) { if (empty($playListData)) {
// check if in the playlist there is some media in the playlist_index and reditect it direct to the media
$video = $plp->getCurrentVideo();
if (!empty($video)) {
$url = Video::getURL($video['id']);;
if (!empty($url)) {
header('Location: ' . $url);
exit;
}
}
if (empty($messagesFromPlayList)) { if (empty($messagesFromPlayList)) {
$messagesFromPlayList = array(); $messagesFromPlayList = array();
} }
@ -126,8 +137,8 @@ if (!empty($evideo)) {
if (empty($video) && !empty($videos_id)) { if (empty($video) && !empty($videos_id)) {
$video = Video::getVideo($videos_id, Video::SORT_TYPE_VIEWABLE, false, false, false, true); $video = Video::getVideo($videos_id, Video::SORT_TYPE_VIEWABLE, false, false, false, true);
if (!empty($video)) { if (!empty($video)) {
$attemptLog[] = "Video loaded successfully line=".__LINE__; $attemptLog[] = "Video loaded successfully line=" . __LINE__;
}else{ } else {
$attemptLog[] = "No video found using Video::getVideo with videos_id = $videos_id and show unlisted $lastGetVideoSQL "; $attemptLog[] = "No video found using Video::getVideo with videos_id = $videos_id and show unlisted $lastGetVideoSQL ";
} }
//var_dump($_GET, $video);exit; //var_dump($_GET, $video);exit;
@ -139,8 +150,8 @@ if (!empty($evideo)) {
if (empty($video)) { if (empty($video)) {
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLE, false, false, true, true); $video = Video::getVideo("", Video::SORT_TYPE_VIEWABLE, false, false, true, true);
if (!empty($video)) { if (!empty($video)) {
$attemptLog[] = "Video loaded successfully line=".__LINE__; $attemptLog[] = "Video loaded successfully line=" . __LINE__;
}else{ } else {
$attemptLog[] = "No video found using Video::getVideo Suggested only and show unlisted $lastGetVideoSQL "; $attemptLog[] = "No video found using Video::getVideo Suggested only and show unlisted $lastGetVideoSQL ";
} }
} }
@ -148,8 +159,8 @@ if (!empty($evideo)) {
if (empty($video)) { if (empty($video)) {
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLE, false, false, false, true); $video = Video::getVideo("", Video::SORT_TYPE_VIEWABLE, false, false, false, true);
if (!empty($video)) { if (!empty($video)) {
$attemptLog[] = "Video loaded successfully line=".__LINE__; $attemptLog[] = "Video loaded successfully line=" . __LINE__;
}else{ } else {
$attemptLog[] = "Fallback attempt using Video::getVideo search all videos and show unlisted $lastGetVideoSQL"; $attemptLog[] = "Fallback attempt using Video::getVideo search all videos and show unlisted $lastGetVideoSQL";
} }
} }
@ -157,8 +168,8 @@ if (!empty($evideo)) {
if (empty($video)) { if (empty($video)) {
$video = AVideoPlugin::getVideo(); $video = AVideoPlugin::getVideo();
if (!empty($video)) { if (!empty($video)) {
$attemptLog[] = "Video loaded successfully line=".__LINE__; $attemptLog[] = "Video loaded successfully line=" . __LINE__;
}else{ } else {
$attemptLog[] = "Not found attempt with AVideoPlugin::getVideo failed. $lastGetVideoSQL"; $attemptLog[] = "Not found attempt with AVideoPlugin::getVideo failed. $lastGetVideoSQL";
} }
} }
@ -283,8 +294,8 @@ if (!empty($evideo)) {
$s = getVideosURL_V2($autoPlayVideo['filename']); $s = getVideosURL_V2($autoPlayVideo['filename']);
$autoPlaySources = getSources($autoPlayVideo['filename'], true); $autoPlaySources = getSources($autoPlayVideo['filename'], true);
$autoPlayURL = $autoPlayVideo['url']; $autoPlayURL = $autoPlayVideo['url'];
$autoPlayPoster = empty($s['jpg_thumbsV2'])? (empty($s['jpg'])? '' : $s['jpg']['url']) : $s['jpg_thumbsV2']['url']; $autoPlayPoster = empty($s['jpg_thumbsV2']) ? (empty($s['jpg']) ? '' : $s['jpg']['url']) : $s['jpg_thumbsV2']['url'];
$autoPlayThumbsSprit = empty($s['jpg_thumbsSprit'])? '' : $s['jpg_thumbsSprit']['url']; $autoPlayThumbsSprit = empty($s['jpg_thumbsSprit']) ? '' : $s['jpg_thumbsSprit']['url'];
} else { } else {
$autoPlaySources = []; $autoPlaySources = [];
$autoPlayURL = ''; $autoPlayURL = '';
@ -343,7 +354,7 @@ if (empty($video)) {
gotToLoginAndComeBackHere(); gotToLoginAndComeBackHere();
} else { } else {
$msg = 'ERROR 1: The video ID [' . $vid->getId() . '] is not available: status=' . Video::$statusDesc[$vid->getStatus()]; $msg = 'ERROR 1: The video ID [' . $vid->getId() . '] is not available: status=' . Video::$statusDesc[$vid->getStatus()];
_error_log($msg. ' filename=' . $vid->getFilename()); _error_log($msg . ' filename=' . $vid->getFilename());
videoNotFound($msg); videoNotFound($msg);
} }
exit; exit;