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);
|
$this->addElement($url);
|
||||||
|
|
||||||
$description = new Zend_Form_Element_Text('description');
|
$description = new Zend_Form_Element_Text('description');
|
||||||
$description->setLabel("Description")
|
$description->setLabel("Name/Description")
|
||||||
->setValue($setting[$prefix.'_description'])
|
->setValue($setting[$prefix.'_description'])
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($description);
|
$this->addElement($description);
|
||||||
|
|
||||||
$mount_info = explode('.',$setting[$prefix.'_mount']);
|
$mount_info = explode('.',$setting[$prefix.'_mount']);
|
||||||
$mount = new Zend_Form_Element_Text('mount');
|
$mount = new Zend_Form_Element_Text('mount');
|
||||||
$mount->class = "with-info";
|
|
||||||
$mount->setLabel("Mount Point")
|
$mount->setLabel("Mount Point")
|
||||||
->setValue($mount_info[0])
|
->setValue($mount_info[0])
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($mount);
|
$this->addElement($mount);
|
||||||
|
|
||||||
$stream_url_value = "http://".$setting[$prefix.'_host'].":".$setting[$prefix.'_port']."/".$mount_info[0].".".$setting[$prefix.'_type'];
|
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$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';
|
$v = 'disabled';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( $k == 'mount'){
|
|
||||||
$v = $d['mount'].".".$d['type'];
|
|
||||||
}
|
|
||||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,39 +76,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt class="block-display info-block">
|
<dt class="block-display info-block">
|
||||||
The following info will be displayed to listeners in their media player:
|
The following info will be displayed to listeners in their media player:
|
||||||
</dt>
|
</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">
|
<dt id="stationDescription-label" class="block-display">
|
||||||
<label for="stationDescription"><?php echo $this->element->getElement('description')->getLabel()?></label>
|
<label for="stationDescription"><?php echo $this->element->getElement('description')->getLabel()?></label>
|
||||||
</dt>
|
</dt>
|
||||||
|
@ -122,12 +92,37 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</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">
|
<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>
|
<label for="outputMountpoint"><?php echo $this->element->getElement('mount')->getLabel()?><span class="info-text-small">(Your radio station website)</span> :</label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd id="outputMountpoint-element" class="block-display">
|
<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()) : ?>
|
<?php if($this->element->getElement('mount')->hasErrors()) : ?>
|
||||||
<ul class='errors'>
|
<ul class='errors'>
|
||||||
<?php foreach($this->element->getElement('mount')->getMessages() as $error): ?>
|
<?php foreach($this->element->getElement('mount')->getMessages() as $error): ?>
|
||||||
|
@ -140,7 +135,7 @@
|
||||||
<label for="outputStreamURL">Stream URL: </label>
|
<label for="outputStreamURL">Stream URL: </label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd id="outputStreamURL-element" class="block-display">
|
<dd id="outputStreamURL-element" class="block-display">
|
||||||
<p id="stream_url"><?php echo $this->stream_url?></p>
|
<p id="stream_url"></p>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
|
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_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');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
|
||||||
|
|
|
@ -8,23 +8,39 @@ function showErrorSections() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function rebuildStreamURL(ele){
|
||||||
function buildStreamUrl(){
|
div = ele.closest("div")
|
||||||
|
host = div.find("input:[id$=-host]").val()
|
||||||
$("input:[id$=-host], input:[id$=-port], input:[id$=-mount], select:[id$=-type]").change(function(){
|
port = div.find("input:[id$=-port]").val()
|
||||||
div = $(this).closest("div")
|
mount = div.find("input:[id$=-mount]").val()
|
||||||
host = div.find("input:[id$=-host]").val()
|
streamurl = ""
|
||||||
port = div.find("input:[id$=-port]").val()
|
if(div.find("select:[id$=-output]").val()=="icecast"){
|
||||||
mount = div.find("input:[id$=-mount]").val()
|
streamurl = "http://"+host
|
||||||
type = div.find("select:[id$=-type]").val()
|
if($.trim(port) != ""){
|
||||||
div.find("#stream_url").html("http://"+host+":"+port+"/"+mount+"."+type)
|
streamurl += ":"+port
|
||||||
if($(this).attr('id').indexOf('type') != -1){
|
|
||||||
div.find("#mount_ext").html("."+type)
|
|
||||||
}
|
}
|
||||||
})
|
if($.trim(mount) != ""){
|
||||||
|
streamurl += "/"+mount
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
streamurl = "http://"+host+":"+port+"/"
|
||||||
|
}
|
||||||
|
div.find("#stream_url").html(streamurl)
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(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() {
|
$('.collapsible-header').click(function() {
|
||||||
$(this).next().toggle('fast');
|
$(this).next().toggle('fast');
|
||||||
|
@ -32,7 +48,17 @@ $(document).ready(function() {
|
||||||
return false;
|
return false;
|
||||||
}).next().hide();
|
}).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()
|
showErrorSections()
|
||||||
|
|
||||||
buildStreamUrl()
|
|
||||||
});
|
});
|
|
@ -110,7 +110,8 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
||||||
restart = true,
|
restart = true,
|
||||||
restart_delay = 5,
|
restart_delay = 5,
|
||||||
url = url,
|
url = url,
|
||||||
genre = genre)
|
genre = genre,
|
||||||
|
name = description)
|
||||||
if bitrate == 24 then
|
if bitrate == 24 then
|
||||||
ignore(output.shoutcast(%mp3(bitrate = 24),s))
|
ignore(output.shoutcast(%mp3(bitrate = 24),s))
|
||||||
elsif bitrate == 32 then
|
elsif bitrate == 32 then
|
||||||
|
|
Loading…
Reference in New Issue