--- /dev/null
+<?php
+require_once 'Services/MediaTomb.php';
+
+function handleRequestMediatomb($fullPath, $prefix)
+{
+ global $mediatomb;
+
+ extract($mediatomb);
+ $smt = new Services_MediaTomb($user, $pass, $host, $port);
+
+ $path = substr($fullPath, strlen($prefix));
+ $container = $smt->getContainerByPath($path);
+ $listItems = array();
+ addPreviousItem($listItems, $fullPath);
+
+ foreach ($container->getContainers() as $subContainer) {
+ $listItems[] = getDirItem(
+ $subContainer->title,
+ $fullPath . $subContainer->title . '/'
+ );
+ }
+
+ foreach ($container->getItemIterator(false) as $item) {
+ $listItems[] = getEpisodeItem(
+ $item->title,
+ $item->url,
+ '',
+ 'MP3'
+ );
+ }
+
+ sendListItems($listItems);
+}
+?>
$desc = (string) $item->description;
$url = $item->enclosure['url'];
- $listItems[] = '<Item>'
- . '<ItemType>ShowEpisode</ItemType>'
- . '<ShowEpisodeName>' . utf8_decode(htmlspecialchars($title)) . '</ShowEpisodeName>'
- . '<ShowEpisodeURL>' . $host1 . 'play-url?url=' . urlencode($url) . '</ShowEpisodeURL>'
- . '<ShowDesc>' . utf8_decode(htmlspecialchars($desc)) . '</ShowDesc>'
- . '<ShowMime>MP3</ShowMime>'
- . '</Item>';
+ $listItems[] = getEpisodeItem(
+ $title,
+ $host1 . 'play-url?url=' . urlencode($url),
+ $desc,
+ 'MP3'
+ );
}
sendListItems($listItems);
}
$host1 = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$host2 = 'http://' . $_SERVER['HTTP_HOST'] . '/';
}
+$cfgFile = $dataDir . 'config.php';
+if (file_exists($cfgFile)) {
+ include $cfgFile;
+}
if (strtolower($fullUri) == '/setupapp/radio567/asp/browsexpa/loginxml.asp?token=0') {
//initial login for "internet radio" and podcasts
exit();
} else if ($path == '/setupapp/radio567/asp/BrowseXPA/LoginXML.asp') {
//"Internet Radio"
- $path = '/internetradio';
+ $path = '/internetradio/';
} else if ($path == '/setupapp/radio567/asp/BrowseXPA/navXML.asp') {
//"Podcasts"
- $path = '/podcasts';
+ $path = '/podcasts/';
} else if ($path == '/RadioNative.php') {
//"My Noxon"
- $path = '/mynoxon';
+ $path = '/mynoxon/';
} else if ($path == '/setupapp/radio567/asp/BrowseXML/FavXML.asp') {
//Internet Radio Station favorites favorited on device
+ sendMessage('Unsupported');
} 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
return;
}
+ if (substr($path, 0, 14) == 'internetradio/') {
+ require_once 'mediatomb.php';
+ handleRequestMediatomb($path, 'internetradio/');
+ return;
+ }
+
+
$fullPath = $varDir . $path;
if (!file_exists($fullPath)) {
sendMessage('Not found: ' . $path);
. '</Item>';
}
+function getEpisodeItem($title, $fullUrl, $desc, $type)
+{
+ return '<Item>'
+ . '<ItemType>ShowEpisode</ItemType>'
+ . '<ShowEpisodeName>' . utf8_decode(htmlspecialchars($title)) . '</ShowEpisodeName>'
+ . '<ShowEpisodeURL>' . $fullUrl . '</ShowEpisodeURL>'
+ . '<ShowDesc>' . utf8_decode(htmlspecialchars($desc)) . '</ShowDesc>'
+ . '<ShowMime>' . $type . '</ShowMime>'
+ . '</Item>';
+}
+
function getPodcastItem($title, $urlPath)
{
global $host1;