}
$dataDir = __DIR__ . '/../data/';
$varDir = realpath(__DIR__ . '/../var') . '/';
+$cacheDir = __DIR__ . '/../www/cache/';
$host1 = 'http://radio567.vtuner.com/';
$host2 = 'http://radio5672.vtuner.com/';
if ($_SERVER['HTTP_HOST'] !== '') {
$host1 = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$host2 = 'http://' . $_SERVER['HTTP_HOST'] . '/';
}
+$cacheDirUrl = $host1 . 'cache/';
$cfgFile = $dataDir . 'config.php';
if (file_exists($cfgFile)) {
include $cfgFile;
} else if ($path == '/RadioNativeFavorites.php') {
//Favorites, defined via web interface
sendMessage('Unsupported');
-} else if (substr($path, 0, 9) == '/play-url') {
- //play a given URL, but first follow all redirects
- //noxon iRadio Cube does not like too many redirections
- // 3 redirects did not work.
- $url = $_GET['url'];
- header('HTTP/1.0 301 Moved Permanently');
- header('Location: ' . getFinalUrl($url));
+} else if ($path == '/transcode') {
+ require_once 'mediatomb.php';
+ transcodeMediatombItem($_GET['mtParentId'], $_GET['mtItemTitle']);
exit();
}
return '<Item>'
. '<ItemType>ShowEpisode</ItemType>'
. '<ShowEpisodeName>' . utf8_decode(htmlspecialchars($title)) . '</ShowEpisodeName>'
- . '<ShowEpisodeURL>' . $fullUrl . '</ShowEpisodeURL>'
+ . '<ShowEpisodeURL>' . htmlspecialchars($fullUrl) . '</ShowEpisodeURL>'
. '<ShowDesc>' . utf8_decode(htmlspecialchars($desc)) . '</ShowDesc>'
. '<ShowMime>' . $type . '</ShowMime>'
. '</Item>';
$listItems[] = getPreviousItem($parentDir);
}
-function getFinalUrl($url)
-{
- $ctx = stream_context_set_default(
- array('http' => array('method' => 'HEAD'))
- );
- //get_headers follows redirects automatically
- $headers = get_headers($url, 1);
- if ($headers !== false && isset($headers['Location'])) {
- return end($headers['Location']);
- }
- return $url;
-}
-
function sendMessage($msg)
{
sendListItems(array(getMessageItem($msg)));