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 ($arStation['epgtitle']
24 && $arStation['epgtitle'] != 'None'
25 && $arStation['epgtitle'] != $arStation['name']
27 if (strtolower(substr($arStation['epgtitle'], 0, strlen($strName))) == strtolower($strName)) {
28 $strEpgTitle = substr($arStation['epgtitle'], strlen($strName));
29 } else if (strtolower(substr($arStation['epgtitle'], 0, strlen($arStation['name']))) == strtolower($arStation['name'])) {
30 $strEpgTitle = substr($arStation['epgtitle'], strlen($arStation['name']));
32 $strEpgTitle = $arStation['epgtitle'];
34 $strEpgTitle = trim($strEpgTitle);
35 if (substr($strEpgTitle, 0, 1) == '-') {
36 $strEpgTitle = trim(substr($strEpgTitle, 1));
39 if (strtoupper($strEpgTitle) == $strEpgTitle) {
40 $strEpgTitle = ucwords(strtolower($strEpgTitle));
43 $strName .= ' - ' . $strEpgTitle;
46 if ($arStation['epgdescription'] && $arStation['epgdescription'] != 'None') {
47 $strDescription = $arStation['epgdescription'];
51 if ($arStation['epgdescription2'] && $arStation['epgdescription2'] != 'None') {
52 $strDescription .= ' ' . $arStation['epgdescription2'];
54 if (!$strDescription) {
55 $strDescription = $strName;
59 'title' => trim($strName),
60 'description' => trim($strDescription)
62 }//function enigtombGetStationTitle(..)
67 if (!function_exists('enigtombFixName')) {
69 * Replaces the given name with a fixed one from the config.
70 * Necessary, because some stations send their names in ALL UPPERCASE
71 * which just isn't nicely readable.
73 * @param string $strName Name to fix
75 * @return string Fixed name
77 function enigtombFixName($strName)
79 $strName = trim($strName);
80 if (isset($GLOBALS['enigtombConfig']['namefixes'][$strName])) {
81 return $GLOBALS['enigtombConfig']['namefixes'][$strName];
85 }//function enigtombFixName(..)