From c1e0e9b0db08fa917d3a5ef474e6f3e316ccf672 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 13 Nov 2018 21:03:43 +0100 Subject: [PATCH] Support password-protected dreambox web interfaces --- README.rst | 5 +++++ data/config.php.dist | 2 +- www/functions.php | 6 +++--- www/play.php | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index b5bd181..0ff7a5e 100644 --- a/README.rst +++ b/README.rst @@ -28,6 +28,11 @@ or IP address by creating a config file in ``data/config.php``. Simply copy ``data/config.php.dist`` onto ``data/config.php`` and adjust it. +If your dreambox web interface is password protected, add the username +and password to the ``$dreamboxUrl`` configuration variable:: + + $dreamboxUrl = 'http://user:pass@dreambox'; + ===== Usage diff --git a/data/config.php.dist b/data/config.php.dist index d6f175a..2ebcf0b 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -2,5 +2,5 @@ //configuration for "play video on dreambox" proxy server // copy it to config.php and adjust it. $youtubedlPath = '/usr/bin/youtube-dl'; -$dreamboxHost = 'dreambox'; +$dreamboxUrl = 'http://dreambox'; ?> diff --git a/www/functions.php b/www/functions.php index 36aacec..b015953 100644 --- a/www/functions.php +++ b/www/functions.php @@ -90,10 +90,10 @@ function extractVideoUrlFromJson($json) return $url; } -function playVideoOnDreambox($videoUrl, $dreamboxHost) +function playVideoOnDreambox($videoUrl, $dreamboxUrl) { ini_set('track_errors', 1); - $xml = @file_get_contents('http://' . $dreamboxHost . '/web/session'); + $xml = @file_get_contents($dreamboxUrl . '/web/session'); if ($xml === false) { list($http, $code, $message) = explode( ' ', $http_response_header[0], 3 @@ -114,7 +114,7 @@ function playVideoOnDreambox($videoUrl, $dreamboxHost) $sx = simplexml_load_string($xml); $token = (string) $sx; - $playUrl = 'http://' . $dreamboxHost + $playUrl = $dreamboxUrl . '/web/mediaplayerplay' . '?file=4097:0:1:0:0:0:0:0:0:0:' . str_replace('%3A', '%253A', rawurlencode($videoUrl)); diff --git a/www/play.php b/www/play.php index 36f3e6c..983cd7f 100644 --- a/www/play.php +++ b/www/play.php @@ -1,6 +1,6 @@