2 $youtubedlPath = '/usr/bin/youtube-dl';
3 $dreamboxUrl = 'http://dreambox';
5 require_once __DIR__ . '/functions.php';
6 $cfgFile = __DIR__ . '/../data/config.php';
7 if (file_exists($cfgFile)) {
11 set_error_handler('errorHandlerStore');
13 $pageUrl = getPageUrl();
14 $json = getYoutubeDlJson($pageUrl, $youtubedlPath);
15 $videoUrl = extractVideoUrlFromJson($json);
16 if (php_sapi_name() == 'cli') {
17 echo $videoUrl . "\n";
19 header('Video-URL: ' . $videoUrl);
21 playVideoOnDreambox($videoUrl, $dreamboxUrl);
24 function errorInput($msg)
26 if (!headers_sent()) {
27 header('HTTP/1.0 400 Bad Request');
28 header('Content-type: text/plain');
34 function errorOut($msg, $httpStatus = '500 Internal Server Error')
36 if (!headers_sent()) {
37 header('HTTP/1.0 ' . $httpStatus);
38 header('Content-type: text/plain');
41 syslog(LOG_ERR, 'playVideoOnDreamboxProxy: ' . $httpStatus . ': ' . $msg);