From 53547a00a04ba956104748231cdc4d140355544d Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 6 Mar 2019 21:20:40 +0100 Subject: [PATCH 1/1] Better error reporting for errors when sending video to dreambox --- www/functions.php | 14 ++++++++++++++ www/play.php | 2 ++ 2 files changed, 16 insertions(+) diff --git a/www/functions.php b/www/functions.php index ffd6667..b094e36 100644 --- a/www/functions.php +++ b/www/functions.php @@ -114,6 +114,13 @@ function playVideoOnDreambox($videoUrl, $dreamboxUrl) ini_set('track_errors', 1); $xml = @file_get_contents($dreamboxUrl . '/web/session'); if ($xml === false) { + if (!isset($http_response_header)) { + errorOut( + 'Error fetching dreambox web interface token: ' + . $GLOBALS['lastError'] + ); + } + list($http, $code, $message) = explode( ' ', $http_response_header[0], 3 ); @@ -161,4 +168,11 @@ function playVideoOnDreambox($videoUrl, $dreamboxUrl) ); } } + +function errorHandlerStore($number, $message, $file, $line) +{ + $GLOBALS['lastError'] = $message; + return false; +} +$GLOBALS['lastError'] = null; ?> diff --git a/www/play.php b/www/play.php index 983cd7f..8109951 100644 --- a/www/play.php +++ b/www/play.php @@ -8,6 +8,8 @@ if (file_exists($cfgFile)) { include $cfgFile; } +set_error_handler('errorHandlerStore'); + $pageUrl = getPageUrl(); $json = getYoutubeDlJson($pageUrl, $youtubedlPath); $videoUrl = extractVideoUrlFromJson($json); -- 2.30.2