CC-2607: Ability to adjust stream bitrate,type,etc from the UI interface
- Modified "Descriptioin" to "Name/Description" - mount point is not append with extension anymore - fix on auto generated stream url - name is used in shoutcast
This commit is contained in:
parent
f2f599f723
commit
a73612afd2
|
@ -94,23 +94,20 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
$this->addElement($url);
|
||||
|
||||
$description = new Zend_Form_Element_Text('description');
|
||||
$description->setLabel("Description")
|
||||
$description->setLabel("Name/Description")
|
||||
->setValue($setting[$prefix.'_description'])
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($description);
|
||||
|
||||
$mount_info = explode('.',$setting[$prefix.'_mount']);
|
||||
$mount = new Zend_Form_Element_Text('mount');
|
||||
$mount->class = "with-info";
|
||||
$mount->setLabel("Mount Point")
|
||||
->setValue($mount_info[0])
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($mount);
|
||||
|
||||
$stream_url_value = "http://".$setting[$prefix.'_host'].":".$setting[$prefix.'_port']."/".$mount_info[0].".".$setting[$prefix.'_type'];
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "stream_url"=>$stream_url_value))
|
||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number))
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@ class Application_Model_StreamSetting {
|
|||
$v = 'disabled';
|
||||
}
|
||||
}
|
||||
if( $k == 'mount'){
|
||||
$v = $d['mount'].".".$d['type'];
|
||||
}
|
||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
||||
$CC_DBC->query($sql);
|
||||
}
|
||||
|
|
|
@ -76,39 +76,9 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
|
||||
<dt class="block-display info-block">
|
||||
The following info will be displayed to listeners in their media player:
|
||||
</dt>
|
||||
|
||||
<dt id="outputGenre-label" class="block-display">
|
||||
<label for="outputGenre"><?php echo $this->element->getElement('genre')->getLabel()?></label>
|
||||
</dt>
|
||||
<dd id="outputGenre-element" class="block-display">
|
||||
<?php echo $this->element->getElement('genre')?>
|
||||
<?php if($this->element->getElement('genre')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('genre')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
|
||||
<dt id="stationURL-label" class="block-display">
|
||||
<label for="stationURL"><?php echo $this->element->getElement('url')->getLabel()?><span class="info-text-small">(Your radio station website)</span> :</label>
|
||||
</dt>
|
||||
<dd id="stationURL-element" class="block-display clearfix">
|
||||
<?php echo $this->element->getElement('url')?>
|
||||
<?php if($this->element->getElement('url')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('url')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
|
||||
<dt id="stationDescription-label" class="block-display">
|
||||
<label for="stationDescription"><?php echo $this->element->getElement('description')->getLabel()?></label>
|
||||
</dt>
|
||||
|
@ -122,12 +92,37 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
|
||||
<dt id="stationURL-label" class="block-display">
|
||||
<label for="stationURL"><?php echo $this->element->getElement('url')->getLabel()?><span class="info-text-small">(Your radio station website)</span> :</label>
|
||||
</dt>
|
||||
<dd id="stationURL-element" class="block-display clearfix">
|
||||
<?php echo $this->element->getElement('url')?>
|
||||
<?php if($this->element->getElement('url')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('url')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="outputGenre-label" class="block-display">
|
||||
<label for="outputGenre"><?php echo $this->element->getElement('genre')->getLabel()?></label>
|
||||
</dt>
|
||||
<dd id="outputGenre-element" class="block-display">
|
||||
<?php echo $this->element->getElement('genre')?>
|
||||
<?php if($this->element->getElement('genre')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('genre')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="outputMountpoint-label" class="block-display">
|
||||
<label for="outputMountpoint"><?php echo $this->element->getElement('mount')->getLabel()?><span class="info-text-small">(Your radio station website)</span> :</label>
|
||||
</dt>
|
||||
<dd id="outputMountpoint-element" class="block-display">
|
||||
<?php echo $this->element->getElement('mount')?><span id="mount_ext" class="input-info">.<?php echo $this->element->getElement('type')->getValue()?></span>
|
||||
<?php echo $this->element->getElement('mount')?>
|
||||
<?php if($this->element->getElement('mount')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('mount')->getMessages() as $error): ?>
|
||||
|
@ -140,7 +135,7 @@
|
|||
<label for="outputStreamURL">Stream URL: </label>
|
||||
</dt>
|
||||
<dd id="outputStreamURL-element" class="block-display">
|
||||
<p id="stream_url"><?php echo $this->stream_url?></p>
|
||||
<p id="stream_url"></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
|
||||
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'mp3, ogg');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
|
||||
|
|
|
@ -8,23 +8,39 @@ function showErrorSections() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buildStreamUrl(){
|
||||
|
||||
$("input:[id$=-host], input:[id$=-port], input:[id$=-mount], select:[id$=-type]").change(function(){
|
||||
div = $(this).closest("div")
|
||||
host = div.find("input:[id$=-host]").val()
|
||||
port = div.find("input:[id$=-port]").val()
|
||||
mount = div.find("input:[id$=-mount]").val()
|
||||
type = div.find("select:[id$=-type]").val()
|
||||
div.find("#stream_url").html("http://"+host+":"+port+"/"+mount+"."+type)
|
||||
if($(this).attr('id').indexOf('type') != -1){
|
||||
div.find("#mount_ext").html("."+type)
|
||||
function rebuildStreamURL(ele){
|
||||
div = ele.closest("div")
|
||||
host = div.find("input:[id$=-host]").val()
|
||||
port = div.find("input:[id$=-port]").val()
|
||||
mount = div.find("input:[id$=-mount]").val()
|
||||
streamurl = ""
|
||||
if(div.find("select:[id$=-output]").val()=="icecast"){
|
||||
streamurl = "http://"+host
|
||||
if($.trim(port) != ""){
|
||||
streamurl += ":"+port
|
||||
}
|
||||
})
|
||||
if($.trim(mount) != ""){
|
||||
streamurl += "/"+mount
|
||||
}
|
||||
}else{
|
||||
streamurl = "http://"+host+":"+port+"/"
|
||||
}
|
||||
div.find("#stream_url").html(streamurl)
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// initial stream url
|
||||
$("dd[id=outputStreamURL-element]").each(function(){
|
||||
rebuildStreamURL($(this))
|
||||
})
|
||||
|
||||
$("input:[id$=-host], input:[id$=-port], input:[id$=-mount]").keyup(function(){
|
||||
rebuildStreamURL($(this))
|
||||
})
|
||||
|
||||
$("select:[id$=-output]").change(function(){
|
||||
rebuildStreamURL($(this))
|
||||
})
|
||||
|
||||
$('.collapsible-header').click(function() {
|
||||
$(this).next().toggle('fast');
|
||||
|
@ -32,7 +48,17 @@ $(document).ready(function() {
|
|||
return false;
|
||||
}).next().hide();
|
||||
|
||||
$("select[id$=-output]").change(function(){
|
||||
if($(this).val() == 'shoutcast'){
|
||||
$(this).closest("div").find("#outputMountpoint-label").hide()
|
||||
$(this).closest("div").find("#outputMountpoint-element").hide()
|
||||
}else{
|
||||
$(this).closest("div").find("#outputMountpoint-label").show()
|
||||
$(this).closest("div").find("#outputMountpoint-element").show()
|
||||
}
|
||||
})
|
||||
|
||||
showErrorSections()
|
||||
|
||||
buildStreamUrl()
|
||||
|
||||
});
|
|
@ -110,7 +110,8 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
|||
restart = true,
|
||||
restart_delay = 5,
|
||||
url = url,
|
||||
genre = genre)
|
||||
genre = genre,
|
||||
name = description)
|
||||
if bitrate == 24 then
|
||||
ignore(output.shoutcast(%mp3(bitrate = 24),s))
|
||||
elsif bitrate == 32 then
|
||||
|
|
Loading…
Reference in New Issue