X-Git-Url: https://git.cweiske.de/playVideoOnDreamboxProxy.git/blobdiff_plain/5cceb8bc5c16343591b2deba59bfb90bedd8f725..34daea5a682bd5b5a95e22964d3fa1e1a3e7837b:/www/functions.php diff --git a/www/functions.php b/www/functions.php index 2d4e515..36aacec 100644 --- a/www/functions.php +++ b/www/functions.php @@ -37,7 +37,12 @@ function getYoutubeDlJson($pageUrl, $youtubedlPath) $lastLine = exec($cmd, $output, $exitCode); if ($exitCode !== 0) { - if (strpos($lastLine, 'Unsupported URL') !== false) { + if ($exitCode === 127) { + errorOut( + 'youtube-dl not found at ' . $youtubedlPath, + '500 youtube-dl not found' + ); + } else if (strpos($lastLine, 'Unsupported URL') !== false) { errorOut( 'Unsupported URL at ' . $pageUrl, '406 Unsupported URL (No video found)' @@ -90,7 +95,21 @@ function playVideoOnDreambox($videoUrl, $dreamboxHost) ini_set('track_errors', 1); $xml = @file_get_contents('http://' . $dreamboxHost . '/web/session'); if ($xml === false) { - errorOut('Failed to fetch dreambox session token: ' . $php_errormsg); + list($http, $code, $message) = explode( + ' ', $http_response_header[0], 3 + ); + if ($code == 401) { + //dreambox web interface authentication has been enabled + errorOut( + 'Error: Web interface authentication is required', + '401 Dreambox web authentication required' + ); + } else { + errorOut( + 'Failed to fetch dreambox session token: ' . $php_errormsg, + $code . ' ' . $message + ); + } } $sx = simplexml_load_string($xml); $token = (string) $sx;