SAAS-587: Add stream urls to station-metadata API
This commit is contained in:
parent
a931e282e1
commit
6dcc7ee2fc
|
@ -637,6 +637,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$result["description"] = Application_Model_Preference::GetStationDescription();
|
||||
$result["timezone"] = Application_Model_Preference::GetDefaultTimezone();
|
||||
$result["locale"] = Application_Model_Preference::GetDefaultLocale();
|
||||
$result["enabled_stream_urls"] = Application_Model_StreamSetting::getStreamUrls();
|
||||
|
||||
// used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
||||
|
|
|
@ -15,7 +15,7 @@ class Application_Form_EmbeddablePlayer extends Zend_Form_SubForm
|
|||
|
||||
$streamURL = new Zend_Form_Element_Radio('stream_url');
|
||||
$urlOptions = Array();
|
||||
foreach(Application_Model_StreamSetting::getStreamUrls() as $type => $url) {
|
||||
foreach(Application_Model_StreamSetting::getEnabledStreamUrls() as $type => $url) {
|
||||
$urlOptions[$url] = $type;
|
||||
}
|
||||
$streamURL->setMultiOptions(
|
||||
|
|
|
@ -62,6 +62,22 @@ class Application_Model_StreamSetting
|
|||
return $result ? $result : "";
|
||||
}
|
||||
|
||||
public static function getEnabledStreamUrls()
|
||||
{
|
||||
$urls = Array();
|
||||
$streamIds = Application_Model_StreamSetting::getEnabledStreamIds();
|
||||
foreach ($streamIds as $id) {
|
||||
$prefix = $id."_";
|
||||
$streamData = Application_Model_StreamSetting::getStreamData($id);
|
||||
$host = $streamData[$prefix."host"];
|
||||
$port = $streamData[$prefix."port"];
|
||||
$mount = $streamData[$prefix."mount"];
|
||||
$type = $streamData[$prefix."type"];
|
||||
$urls[$type] = "http://$host:$port/$mount";
|
||||
}
|
||||
return $urls;
|
||||
}
|
||||
|
||||
/* Returns the id's of all streams that are enabled in an array. An
|
||||
* example of the array returned in JSON notation is ["s1", "s2", "s3"] */
|
||||
public static function getEnabledStreamIds()
|
||||
|
|
Loading…
Reference in New Issue