* @license LGPL http://www.gnu.org/copyleft/lesser.html */ require_once 'DreamboxBouqets.php'; require_once 'Services/MediaTomb.php'; require_once 'config.php'; echo "fetching bouqets\n"; $arBouqets = DreamboxBouqets::fetchRadioBouqets( $GLOBALS['enigtombConfig']['dreambox']['host'] ); $mt = new Services_MediaTomb( $GLOBALS['enigtombConfig']['mediatomb']['user'], $GLOBALS['enigtombConfig']['mediatomb']['pass'], $GLOBALS['enigtombConfig']['mediatomb']['host'], $GLOBALS['enigtombConfig']['mediatomb']['port'] ); $strRadiodir = $GLOBALS['enigtombConfig']['mediatomb']['radiodir']; $radiodir = $mt->getContainerByPath($strRadiodir); if ($radiodir !== null) { $mt->delete($radiodir); } foreach ($arBouqets as $strBouqetName => $arStations) { echo "adding " . $strBouqetName . "\n"; if ($strBouqetName == $GLOBALS['enigtombConfig']['mediatomb']['rootBouqet']) { $dir = $mt->getContainerByPath($strRadiodir); if ($dir === null) { $dir = $mt->createContainerByPath($strRadiodir); } } else { $dir = $mt->createContainerByPath($strRadiodir . '/' . $strBouqetName); } foreach ($arStations as $arStation) { echo " adding " . $arStation['name'] . "\n"; $strName = $arStation['name']; if ($arStation['epgtitle']) { $strName .= ' - ' . $arStation['epgtitle']; } if ($arStation['epgdescription']) { $strDescription = $arStation['epgdescription']; } else { $strDescription = ''; } if ($arStation['epgdescription2']) { $strDescription .= ' ' . $arStation['epgdescription2']; } if (!$strDescription) { $strDescription = $strName; } $mt->createExternalLink( $dir->id, $strName, $arStation['stream'], trim($strDescription), $GLOBALS['enigtombConfig']['mediatomb']['mimetype'], Services_MediaTomb::PROTOCOL_HTTP_GET ); } } ?>