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 if (!headers_sent()) {
25 header('HTTP/1.0 400 Bad Request');
26 header('Content-type: text/plain');
32 function errorOut($msg, $httpStatus = '500 Internal Server Error')
34 if (!headers_sent()) {
35 header('HTTP/1.0 ' . $httpStatus);
36 header('Content-type: text/plain');
39 syslog(LOG_ERR, 'playVideoOnDreamboxProxy: ' . $httpStatus . ': ' . $msg);