* @license LGPL http://www.gnu.org/copyleft/lesser.html */ if (!function_exists('enigtombGetStationTitle')) { /** * Returns a proper title from the bouqet station data * for the mediatomb entry * * @param array $arStation Station in a dreambox bouqet * * @return array Array of title and description to use in the UPnP server. * Keys title and description */ function enigtombGetStationTitle($arStation) { $strName = enigtombFixName($arStation['name']); if (isset($arStation['epgtitle']) && $arStation['epgtitle'] && $arStation['epgtitle'] != 'None' && $arStation['epgtitle'] != $arStation['name'] ) { if (strtolower(substr($arStation['epgtitle'], 0, strlen($strName))) == strtolower($strName)) { $strEpgTitle = substr($arStation['epgtitle'], strlen($strName)); } else if (strtolower(substr($arStation['epgtitle'], 0, strlen($arStation['name']))) == strtolower($arStation['name'])) { $strEpgTitle = substr($arStation['epgtitle'], strlen($arStation['name'])); } else { $strEpgTitle = $arStation['epgtitle']; } $strEpgTitle = trim($strEpgTitle); if (substr($strEpgTitle, 0, 1) == '-') { $strEpgTitle = trim(substr($strEpgTitle, 1)); } if (strtoupper($strEpgTitle) == $strEpgTitle) { $strEpgTitle = ucwords(strtolower($strEpgTitle)); } $strName .= ' - ' . $strEpgTitle; } if (isset($arStation['epgdescription']) && $arStation['epgdescription'] && $arStation['epgdescription'] != 'None' ) { $strDescription = $arStation['epgdescription']; } else { $strDescription = ''; } if (isset($arStation['epgdescription2']) && $arStation['epgdescription2'] && $arStation['epgdescription2'] != 'None' ) { $strDescription .= ' ' . $arStation['epgdescription2']; } if (!$strDescription) { $strDescription = $strName; } return array( 'title' => trim($strName), 'description' => trim($strDescription) ); }//function enigtombGetStationTitle(..) } if (!function_exists('enigtombFixName')) { /** * Replaces the given name with a fixed one from the config. * Necessary, because some stations send their names in ALL UPPERCASE * which just isn't nicely readable. * * @param string $strName Name to fix * * @return string Fixed name */ function enigtombFixName($strName) { $strName = trim($strName); if (isset($GLOBALS['enigtombConfig']['namefixes'][$strName])) { return $GLOBALS['enigtombConfig']['namefixes'][$strName]; } else { return $strName; } }//function enigtombFixName(..) } ?>