X-Git-Url: https://git.cweiske.de/noxon-gateway.git/blobdiff_plain/931d5803649e32b043d7af9034dde326ddb1fefa..49f9d0097f92966d8d09cb8eb05708425ea3e5ab:/src/podcasts.php diff --git a/src/podcasts.php b/src/podcasts.php index 9948af4..bb8f5ce 100644 --- a/src/podcasts.php +++ b/src/podcasts.php @@ -1,60 +1,40 @@ ' - . 'ShowOnDemand' - . '' . htmlspecialchars($title) . '' - . 'http://radio567.vtuner.com/podcasts/' . urlencode(basename($file)) . '' - . ''; - } - sendListItems($listItems); -} + global $varDir, $host1; -function sendPodcast($file) -{ - //strip /podcasts/ - $file = substr(urldecode($file), 10); + $file = urldecode($path); if (strpos($file, '..') !== false) { sendMessage('No'); return; } - $path = __DIR__ . '/../var/podcasts/' . $file; - if (!file_exists($path)) { - return sendMessage('File does not exist: ' . $file); + $fullPath = $varDir . $path; + if (!file_exists($fullPath)) { + return sendMessage('File does not exist: ' . $path); } - $url = trim(file_get_contents($path)); + $url = trim(file_get_contents($fullPath)); - $cacheFile = '/tmp/podcast-' . md5($file) . '.xml'; + $cacheFile = '/tmp/podcast-' . md5($path) . '.xml'; downloadIfNewer($url, $cacheFile); $sx = simplexml_load_file($cacheFile); $listItems = array(); + foreach ($sx->channel->item as $item) { $title = (string) $item->title; $desc = (string) $item->description; $url = $item->enclosure['url']; - $listItems[] = '' - . 'ShowEpisode' - . '' . utf8_decode(htmlspecialchars($title)) . '' - . 'http://radio567.vtuner.com/play-url?url=' . urlencode($url) . '' - //. '' . htmlspecialchars($url) . '' - . '' . utf8_decode(htmlspecialchars($desc)) . '' - . 'MP3' - . ''; + $listItems[] = getEpisodeItem( + $title, + $host1 . 'deredirect.php?url=' . urlencode($url), + $desc, + 'MP3' + ); } - sendListItems($listItems); + sendListItems($listItems, buildPreviousItem($path)); }