3 * Copies all radio bouqets into a folder on mediatomb.
4 * Deletes/clears the folder at first.
6 * @author Christian Weiske <cweiske@php.net>
7 * @license LGPL http://www.gnu.org/copyleft/lesser.html
9 require_once 'DreamboxBouqets.php';
10 require_once 'Services/MediaTomb.php';
11 require_once 'config.php';
13 echo "fetching bouqets\n";
14 $arBouqets = DreamboxBouqets::fetchRadioBouqets(
15 $GLOBALS['enigtombConfig']['dreambox']['host']
18 $mt = new Services_MediaTomb(
19 $GLOBALS['enigtombConfig']['mediatomb']['user'],
20 $GLOBALS['enigtombConfig']['mediatomb']['pass'],
21 $GLOBALS['enigtombConfig']['mediatomb']['host'],
22 $GLOBALS['enigtombConfig']['mediatomb']['port']
25 $strRadiodir = $GLOBALS['enigtombConfig']['mediatomb']['radiodir'];
27 $radiodir = $mt->getContainerByPath($strRadiodir);
28 if ($radiodir !== null) {
29 $mt->delete($radiodir);
32 foreach ($arBouqets as $strBouqetName => $arStations) {
33 echo "adding " . $strBouqetName . "\n";
34 if ($strBouqetName == $GLOBALS['enigtombConfig']['mediatomb']['rootBouqet']) {
35 $dir = $mt->getContainerByPath($strRadiodir);
37 $dir = $mt->createContainerByPath($strRadiodir);
40 $dir = $mt->createContainerByPath($strRadiodir . '/' . $strBouqetName);
43 foreach ($arStations as $arStation) {
44 echo " adding " . $arStation['name'] . "\n";
45 $strName = $arStation['name'];
46 if ($arStation['epgtitle']) {
47 $strName .= ' - ' . $arStation['epgtitle'];
49 if ($arStation['epgdescription']) {
50 $strDescription = $arStation['epgdescription'];
54 if ($arStation['epgdescription2']) {
55 $strDescription .= ' ' . $arStation['epgdescription2'];
57 if (!$strDescription) {
58 $strDescription = $strName;
60 $mt->createExternalLink(
61 $dir->id, $strName, $arStation['stream'], trim($strDescription),
62 $GLOBALS['enigtombConfig']['mediatomb']['mimetype'],
63 Services_MediaTomb::PROTOCOL_HTTP_GET