git.cweiske.de
/
playVideoOnDreamboxProxy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fdc1217
)
better error reporting, syslog
author
Christian Weiske
<cweiske@cweiske.de>
Sun, 15 Jan 2017 12:23:10 +0000
(13:23 +0100)
committer
Christian Weiske
<cweiske@cweiske.de>
Sun, 15 Jan 2017 12:23:10 +0000
(13:23 +0100)
www/play.php
patch
|
blob
|
history
diff --git
a/www/play.php
b/www/play.php
index 314fee7a660d0fc5c19aa7ab6153234148b57088..a9adc5b8a83953a35a69eb81e96410d7033101d6 100644
(file)
--- a/
www/play.php
+++ b/
www/play.php
@@
-50,7
+50,10
@@
function extractVideoUrl($pageUrl, $youtubedlPath)
$lastLine = exec($cmd, $output, $exitCode);
if ($exitCode !== 0) {
if (strpos($lastLine, 'Unsupported URL') !== false) {
$lastLine = exec($cmd, $output, $exitCode);
if ($exitCode !== 0) {
if (strpos($lastLine, 'Unsupported URL') !== false) {
- errorOut('Unsupported URL', '400 Unsupported URL (No video found)');
+ errorOut(
+ 'Unsupported URL at ' . $pageUrl,
+ '406 Unsupported URL (No video found)'
+ );
} else {
errorOut('youtube-dl error: ' . $lastLine);
}
} else {
errorOut('youtube-dl error: ' . $lastLine);
}
@@
-78,7
+81,7
@@
function extractVideoUrl($pageUrl, $youtubedlPath)
function playVideoOnDreambox($videoUrl, $dreamboxHost)
{
ini_set('track_errors', 1);
function playVideoOnDreambox($videoUrl, $dreamboxHost)
{
ini_set('track_errors', 1);
- $xml = file_get_contents('http://' . $dreamboxHost . '/web/session');
+ $xml =
@
file_get_contents('http://' . $dreamboxHost . '/web/session');
if ($xml === false) {
errorOut('Failed to fetch dreambox session token: ' . $php_errormsg);
}
if ($xml === false) {
errorOut('Failed to fetch dreambox session token: ' . $php_errormsg);
}
@@
-117,6
+120,7
@@
function errorInput($msg)
header('HTTP/1.0 400 Bad Request');
header('Content-type: text/plain');
echo $msg . "\n";
header('HTTP/1.0 400 Bad Request');
header('Content-type: text/plain');
echo $msg . "\n";
+ syslog(LOG_ERR, 'playVideoOnDreamboxProxy: ' . $httpStatus . ':' . $msg);
exit(1);
}
exit(1);
}
@@
-125,6
+129,7
@@
function errorOut($msg, $httpStatus = '500 Internal Server Error')
header('HTTP/1.0 ' . $httpStatus);
header('Content-type: text/plain');
echo $msg . "\n";
header('HTTP/1.0 ' . $httpStatus);
header('Content-type: text/plain');
echo $msg . "\n";
+ syslog(LOG_ERR, 'playVideoOnDreamboxProxy: ' . $httpStatus . ': ' . $msg);
exit(2);
}
?>
\ No newline at end of file
exit(2);
}
?>
\ No newline at end of file