Support password-protected dreambox web interfaces v1.0.0
authorChristian Weiske <cweiske@cweiske.de>
Tue, 13 Nov 2018 20:03:43 +0000 (21:03 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 13 Nov 2018 20:03:43 +0000 (21:03 +0100)
README.rst
data/config.php.dist
www/functions.php
www/play.php

index b5bd18166c83ca1bd095cd170886a3486519d9c2..0ff7a5ef4eb3090adb86728430bb653dfd34774b 100644 (file)
@@ -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.
 
 
 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
 
 =====
 Usage
index d6f175ae88ca7d656164c74452b482cd4febc36d..2ebcf0b432cafd62e7715622a61935ea71677554 100644 (file)
@@ -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';
 //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';
 ?>
 ?>
index 36aacec10baca5f000e7d9c218bfb4f75467ead5..b015953624d56f0f3c7884d22441544097a22919 100644 (file)
@@ -90,10 +90,10 @@ function extractVideoUrlFromJson($json)
     return $url;
 }
 
     return $url;
 }
 
-function playVideoOnDreambox($videoUrl, $dreamboxHost)
+function playVideoOnDreambox($videoUrl, $dreamboxUrl)
 {
     ini_set('track_errors', 1);
 {
     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
     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;
 
     $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));
         . '/web/mediaplayerplay'
         . '?file=4097:0:1:0:0:0:0:0:0:0:'
         . str_replace('%3A', '%253A', rawurlencode($videoUrl));
index 36f3e6c56e7009e02144f488b9d675f943d28eb3..983cd7ff37f166ad2d13b1e61dc5a4f9ff1e6a3d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 $youtubedlPath = '/usr/bin/youtube-dl';
 <?php
 $youtubedlPath = '/usr/bin/youtube-dl';
-$dreamboxHost  = 'dreambox';
+$dreamboxUrl   = 'http://dreambox';
 
 require_once __DIR__ . '/functions.php';
 $cfgFile = __DIR__ . '/../data/config.php';
 
 require_once __DIR__ . '/functions.php';
 $cfgFile = __DIR__ . '/../data/config.php';
@@ -16,7 +16,7 @@ if (php_sapi_name() == 'cli') {
 } else {
     header('Video-URL: ' . $videoUrl);
 }
 } else {
     header('Video-URL: ' . $videoUrl);
 }
-playVideoOnDreambox($videoUrl, $dreamboxHost);
+playVideoOnDreambox($videoUrl, $dreamboxUrl);
 
 
 function errorInput($msg)
 
 
 function errorInput($msg)