2 $youtubedlPath = '/usr/bin/youtube-dl';
3 $dreamboxHost = 'dreambox';
5 require_once __DIR__ . '/functions.php';
6 $cfgFile = __DIR__ . '/../data/config.php';
7 if (file_exists($cfgFile)) {
11 $pageUrl = getPageUrl();
12 $json = getYoutubeDlJson($pageUrl, $youtubedlPath);
13 $videoUrl = extractVideoUrlFromJson($json);
14 if (php_sapi_name() == 'cli') {
15 echo $videoUrl . "\n";
17 header('Video-URL: ' . $videoUrl);
19 playVideoOnDreambox($videoUrl, $dreamboxHost);
22 function errorInput($msg)
24 header('HTTP/1.0 400 Bad Request');
25 header('Content-type: text/plain');
30 function errorOut($msg, $httpStatus = '500 Internal Server Error')
32 header('HTTP/1.0 ' . $httpStatus);
33 header('Content-type: text/plain');
35 syslog(LOG_ERR, 'playVideoOnDreamboxProxy: ' . $httpStatus . ': ' . $msg);