3 * Functions used in syncing
5 * @author Christian Weiske <cweiske@cweiske.de>
6 * @license LGPL http://www.gnu.org/copyleft/lesser.html
9 if (!function_exists('enigtombGetStationTitle')) {
11 * Returns a proper title from the bouqet station data
12 * for the mediatomb entry
14 * @param array $arStation Station in a dreambox bouqet
16 * @return array Array of title and description to use in the UPnP server.
17 * Keys title and description
19 function enigtombGetStationTitle($arStation)
21 $strName = enigtombFixName($arStation['name']);
23 if (isset($arStation['epgtitle'])
24 && $arStation['epgtitle']
25 && $arStation['epgtitle'] != 'None'
26 && $arStation['epgtitle'] != $arStation['name']
28 if (strtolower(substr($arStation['epgtitle'], 0, strlen($strName))) == strtolower($strName)) {
29 $strEpgTitle = substr($arStation['epgtitle'], strlen($strName));
30 } else if (strtolower(substr($arStation['epgtitle'], 0, strlen($arStation['name']))) == strtolower($arStation['name'])) {
31 $strEpgTitle = substr($arStation['epgtitle'], strlen($arStation['name']));
33 $strEpgTitle = $arStation['epgtitle'];
35 $strEpgTitle = trim($strEpgTitle);
36 if (substr($strEpgTitle, 0, 1) == '-') {
37 $strEpgTitle = trim(substr($strEpgTitle, 1));
40 if (strtoupper($strEpgTitle) == $strEpgTitle) {
41 $strEpgTitle = ucwords(strtolower($strEpgTitle));
44 $strName .= ' - ' . $strEpgTitle;
47 if (isset($arStation['epgdescription'])
48 && $arStation['epgdescription'] && $arStation['epgdescription'] != 'None'
50 $strDescription = $arStation['epgdescription'];
54 if (isset($arStation['epgdescription2'])
55 && $arStation['epgdescription2'] && $arStation['epgdescription2'] != 'None'
57 $strDescription .= ' ' . $arStation['epgdescription2'];
59 if (!$strDescription) {
60 $strDescription = $strName;
64 'title' => trim($strName),
65 'description' => trim($strDescription)
67 }//function enigtombGetStationTitle(..)
72 if (!function_exists('enigtombFixName')) {
74 * Replaces the given name with a fixed one from the config.
75 * Necessary, because some stations send their names in ALL UPPERCASE
76 * which just isn't nicely readable.
78 * @param string $strName Name to fix
80 * @return string Fixed name
82 function enigtombFixName($strName)
84 $strName = trim($strName);
85 if (isset($GLOBALS['enigtombConfig']['namefixes'][$strName])) {
86 return $GLOBALS['enigtombConfig']['namefixes'][$strName];
90 }//function enigtombFixName(..)