CC-2706: Streams should have a username field
- adding "User" field on stream setting form - change key name from "output_s1" to "s1_output" format to be consistent - changed order of inserting in default.sql file - hiding username field on shoutcast selection - liquidsoap and pypo takes care of user field input
This commit is contained in:
parent
9eb21cb327
commit
58837ff89b
|
@ -38,74 +38,83 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
|
|
||||||
$enable = new Zend_Form_Element_Checkbox('enable');
|
$enable = new Zend_Form_Element_Checkbox('enable');
|
||||||
$enable->setLabel('Enabled:')
|
$enable->setLabel('Enabled:')
|
||||||
->setValue($setting['output_'.$prefix] != 'disabled'?1:0)
|
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($enable);
|
$this->addElement($enable);
|
||||||
|
|
||||||
$type = new Zend_Form_Element_Select('type');
|
$type = new Zend_Form_Element_Select('type');
|
||||||
$type->setLabel("Type:")
|
$type->setLabel("Type:")
|
||||||
->setMultiOptions($stream_types)
|
->setMultiOptions($stream_types)
|
||||||
->setValue($setting[$prefix.'_type'])
|
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($type);
|
$this->addElement($type);
|
||||||
|
|
||||||
$bitrate = new Zend_Form_Element_Select('bitrate');
|
$bitrate = new Zend_Form_Element_Select('bitrate');
|
||||||
$bitrate->setLabel("Bitrate:")
|
$bitrate->setLabel("Bitrate:")
|
||||||
->setMultiOptions($stream_bitrates)
|
->setMultiOptions($stream_bitrates)
|
||||||
->setValue($setting[$prefix.'_bitrate'])
|
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($bitrate);
|
$this->addElement($bitrate);
|
||||||
|
|
||||||
$output = new Zend_Form_Element_Select('output');
|
$output = new Zend_Form_Element_Select('output');
|
||||||
$output->setLabel("Output to:")
|
$output->setLabel("Output to:")
|
||||||
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
|
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
|
||||||
->setValue($setting['output_'.$prefix])
|
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($output);
|
$this->addElement($output);
|
||||||
|
|
||||||
$host = new Zend_Form_Element_Text('host');
|
$host = new Zend_Form_Element_Text('host');
|
||||||
$host->setLabel("Server")
|
$host->setLabel("Server")
|
||||||
->setValue($setting[$prefix.'_host'])
|
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($host);
|
$this->addElement($host);
|
||||||
|
|
||||||
$port = new Zend_Form_Element_Text('port');
|
$port = new Zend_Form_Element_Text('port');
|
||||||
$port->setLabel("Port")
|
$port->setLabel("Port")
|
||||||
->setValue($setting[$prefix.'_port'])
|
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($port);
|
$this->addElement($port);
|
||||||
|
|
||||||
$pass = new Zend_Form_Element_Text('pass');
|
$pass = new Zend_Form_Element_Text('pass');
|
||||||
$pass->setLabel("Password")
|
$pass->setLabel("Password")
|
||||||
->setValue($setting[$prefix.'_pass'])
|
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($pass);
|
$this->addElement($pass);
|
||||||
|
|
||||||
$genre = new Zend_Form_Element_Text('genre');
|
$genre = new Zend_Form_Element_Text('genre');
|
||||||
$genre->setLabel("Genre:")
|
$genre->setLabel("Genre")
|
||||||
->setValue($setting[$prefix.'_genre'])
|
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($genre);
|
$this->addElement($genre);
|
||||||
|
|
||||||
$url = new Zend_Form_Element_Text('url');
|
$url = new Zend_Form_Element_Text('url');
|
||||||
$url->setLabel("URL")
|
$url->setLabel("URL")
|
||||||
->setValue($setting[$prefix.'_url'])
|
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($url);
|
$this->addElement($url);
|
||||||
|
|
||||||
$description = new Zend_Form_Element_Text('description');
|
$description = new Zend_Form_Element_Text('description');
|
||||||
$description->setLabel("Name/Description")
|
$description->setLabel("Name/Description")
|
||||||
->setValue($setting[$prefix.'_description'])
|
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($description);
|
$this->addElement($description);
|
||||||
|
|
||||||
$mount_info = explode('.',$setting[$prefix.'_mount']);
|
$mount_info = array();
|
||||||
|
if(isset($setting[$prefix.'_mount'])){
|
||||||
|
$mount_info = explode('.',$setting[$prefix.'_mount']);
|
||||||
|
}
|
||||||
$mount = new Zend_Form_Element_Text('mount');
|
$mount = new Zend_Form_Element_Text('mount');
|
||||||
$mount->setLabel("Mount Point")
|
$mount->setLabel("Mount Point")
|
||||||
->setValue($mount_info[0])
|
->setValue(isset($mount_info[0])?$mount_info[0]:"")
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($mount);
|
$this->addElement($mount);
|
||||||
|
|
||||||
|
$user = new Zend_Form_Element_Text('user');
|
||||||
|
$user->setLabel("Username")
|
||||||
|
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($user);
|
||||||
|
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number))
|
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number))
|
||||||
));
|
));
|
||||||
|
@ -124,11 +133,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
||||||
$element->addError("Port cannot be empty.");
|
$element->addError("Port cannot be empty.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
}
|
}
|
||||||
if($data['pass'] == ''){
|
|
||||||
$element = $this->getElement("pass");
|
|
||||||
$element->addError("Password cannot be empty.");
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
if($data['output'] == 'icecast'){
|
if($data['output'] == 'icecast'){
|
||||||
if($data['mount'] == ''){
|
if($data['mount'] == ''){
|
||||||
$element = $this->getElement("mount");
|
$element = $this->getElement("mount");
|
||||||
|
|
|
@ -26,7 +26,6 @@ class Application_Model_StreamSetting {
|
||||||
foreach($d as $k=>$v){
|
foreach($d as $k=>$v){
|
||||||
$keyname = $prefix."_".$k;
|
$keyname = $prefix."_".$k;
|
||||||
if( $k == 'output'){
|
if( $k == 'output'){
|
||||||
$keyname = $k."_".$prefix;
|
|
||||||
if( $d["enable"] == 0){
|
if( $d["enable"] == 0){
|
||||||
$v = 'disabled';
|
$v = 'disabled';
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,8 +63,21 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt id="outputUser-label" class="block-display">
|
||||||
|
<label for="outputUser"><?php echo $this->element->getElement('user')->getLabel()?> :</label>
|
||||||
|
</dt>
|
||||||
|
<dd id="outputUser-element" class="block-display">
|
||||||
|
<?php echo $this->element->getElement('user')?>
|
||||||
|
<?php if($this->element->getElement('user')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('user')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
<dt id="outputPassword-label" class="block-display">
|
<dt id="outputPassword-label" class="block-display">
|
||||||
<label class="optional" for="outputPassword"><?php echo $this->element->getElement('pass')->getLabel()?><span class="info-text-small">(Required)</span> :</label>
|
<label class="optional" for="outputPassword"><?php echo $this->element->getElement('pass')->getLabel()?> :</label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd id="outputPassword-element" class="block-display clearfix">
|
<dd id="outputPassword-element" class="block-display clearfix">
|
||||||
<?php echo $this->element->getElement('pass')?>
|
<?php echo $this->element->getElement('pass')?>
|
||||||
|
@ -80,7 +93,7 @@
|
||||||
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="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>
|
||||||
<dd id="stationDescription-element" class="block-display clearfix">
|
<dd id="stationDescription-element" class="block-display clearfix">
|
||||||
<?php echo $this->element->getElement('description')?>
|
<?php echo $this->element->getElement('description')?>
|
||||||
|
@ -106,7 +119,7 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
<dt id="outputGenre-label" class="block-display">
|
<dt id="outputGenre-label" class="block-display">
|
||||||
<label for="outputGenre"><?php echo $this->element->getElement('genre')->getLabel()?></label>
|
<label for="outputGenre"><?php echo $this->element->getElement('genre')->getLabel()?> :</label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd id="outputGenre-element" class="block-display">
|
<dd id="outputGenre-element" class="block-display">
|
||||||
<?php echo $this->element->getElement('genre')?>
|
<?php echo $this->element->getElement('genre')?>
|
||||||
|
|
|
@ -4,38 +4,42 @@ 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');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_icecast_vorbis_metadata', 'false', 'boolean');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_s1', 'icecast', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_output', 'icecast', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_s2', 'disabled', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_s3', 'disabled', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_type', 'ogg', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_type', 'ogg', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_type', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_type', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_bitrate', '128', 'integer');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_bitrate', '128', 'integer');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_bitrate', '', 'integer');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_bitrate', '', 'integer');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_host', '127.0.0.1', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_host', '127.0.0.1', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_port', '8000', 'integer');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_port', '8000', 'integer');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_port', '', 'integer');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_user', '', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_port', '', 'integer');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_pass', 'hackme', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_pass', 'hackme', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_pass', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_pass', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_mount', 'airtime_128.ogg', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_mount', 'airtime_128.ogg', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_mount', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_mount', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_url', 'http://airtime.sourcefabric.org', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_url', 'http://airtime.sourcefabric.org', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_url', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_url', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_description', 'Airtime Radio! Stream #1', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_description', 'Airtime Radio! Stream #1', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_description', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_description', '', 'string');
|
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_genre', 'genre', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_genre', 'genre', 'string');
|
||||||
|
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_output', 'disabled', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_type', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_bitrate', '', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_port', '', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_user', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_pass', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_mount', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_url', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_description', '', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_genre', '', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_genre', '', 'string');
|
||||||
|
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_output', 'disabled', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_type', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_bitrate', '', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_port', '', 'integer');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_user', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_pass', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_mount', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_url', '', 'string');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_description', '', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_genre', '', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_genre', '', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('log_file', '/var/log/airtime/pypo-liquidsoap/<script>.log', 'string');
|
|
||||||
|
|
||||||
INSERT INTO cc_country (isocode, name) VALUES ('AFG', 'Afghanistan ');
|
INSERT INTO cc_country (isocode, name) VALUES ('AFG', 'Afghanistan ');
|
||||||
INSERT INTO cc_country (isocode, name) VALUES ('ALA', 'Åland Islands');
|
INSERT INTO cc_country (isocode, name) VALUES ('ALA', 'Åland Islands');
|
||||||
|
|
|
@ -28,6 +28,20 @@ function rebuildStreamURL(ele){
|
||||||
div.find("#stream_url").html(streamurl)
|
div.find("#stream_url").html(streamurl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hideForShoutcast(ele){
|
||||||
|
ele.closest("div").find("#outputMountpoint-label").hide()
|
||||||
|
ele.closest("div").find("#outputMountpoint-element").hide()
|
||||||
|
ele.closest("div").find("#outputUser-label").hide()
|
||||||
|
ele.closest("div").find("#outputUser-element").hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
function showForIcecast(ele){
|
||||||
|
ele.closest("div").find("#outputMountpoint-label").show()
|
||||||
|
ele.closest("div").find("#outputMountpoint-element").show()
|
||||||
|
ele.closest("div").find("#outputUser-label").show()
|
||||||
|
ele.closest("div").find("#outputUser-element").show()
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// initial stream url
|
// initial stream url
|
||||||
$("dd[id=outputStreamURL-element]").each(function(){
|
$("dd[id=outputStreamURL-element]").each(function(){
|
||||||
|
@ -50,11 +64,15 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$("select[id$=-output]").change(function(){
|
$("select[id$=-output]").change(function(){
|
||||||
if($(this).val() == 'shoutcast'){
|
if($(this).val() == 'shoutcast'){
|
||||||
$(this).closest("div").find("#outputMountpoint-label").hide()
|
hideForShoutcast($(this))
|
||||||
$(this).closest("div").find("#outputMountpoint-element").hide()
|
|
||||||
}else{
|
}else{
|
||||||
$(this).closest("div").find("#outputMountpoint-label").show()
|
showForIcecast($(this))
|
||||||
$(this).closest("div").find("#outputMountpoint-element").show()
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$("select[id$=-output]").each(function(){
|
||||||
|
if($(this).val() == 'shoutcast'){
|
||||||
|
hideForShoutcast($(this))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,13 @@ def to_live(old,new) =
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s) =
|
def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, user, s) =
|
||||||
if output_type == "icecast" then
|
if output_type == "icecast" then
|
||||||
output.icecast = output.icecast(host = host,
|
user_ref = ref user
|
||||||
|
if user == "" then
|
||||||
|
user_ref := "source"
|
||||||
|
end
|
||||||
|
output = output.icecast(host = host,
|
||||||
port = port,
|
port = port,
|
||||||
password = pass,
|
password = pass,
|
||||||
mount = mount_point,
|
mount = mount_point,
|
||||||
|
@ -48,30 +52,31 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
||||||
restart_delay = 5,
|
restart_delay = 5,
|
||||||
url = url,
|
url = url,
|
||||||
description = description,
|
description = description,
|
||||||
genre = genre)
|
genre = genre,
|
||||||
|
user = !user_ref)
|
||||||
if type == "mp3" then
|
if type == "mp3" then
|
||||||
if bitrate == 24 then
|
if bitrate == 24 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 24),s))
|
ignore(output(%mp3(bitrate = 24),s))
|
||||||
elsif bitrate == 32 then
|
elsif bitrate == 32 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 32),s))
|
ignore(output(%mp3(bitrate = 32),s))
|
||||||
elsif bitrate == 48 then
|
elsif bitrate == 48 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 48),s))
|
ignore(output(%mp3(bitrate = 48),s))
|
||||||
elsif bitrate == 64 then
|
elsif bitrate == 64 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 64),s))
|
ignore(output(%mp3(bitrate = 64),s))
|
||||||
elsif bitrate == 96 then
|
elsif bitrate == 96 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 96),s))
|
ignore(output(%mp3(bitrate = 96),s))
|
||||||
elsif bitrate == 128 then
|
elsif bitrate == 128 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 128),s))
|
ignore(output(%mp3(bitrate = 128),s))
|
||||||
elsif bitrate == 160 then
|
elsif bitrate == 160 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 160),s))
|
ignore(output(%mp3(bitrate = 160),s))
|
||||||
elsif bitrate == 192 then
|
elsif bitrate == 192 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 192),s))
|
ignore(output(%mp3(bitrate = 192),s))
|
||||||
elsif bitrate == 224 then
|
elsif bitrate == 224 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 224),s))
|
ignore(output(%mp3(bitrate = 224),s))
|
||||||
elsif bitrate == 256 then
|
elsif bitrate == 256 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 256),s))
|
ignore(output(%mp3(bitrate = 256),s))
|
||||||
elsif bitrate == 320 then
|
elsif bitrate == 320 then
|
||||||
ignore(output.icecast(%mp3(bitrate = 320),s))
|
ignore(output(%mp3(bitrate = 320),s))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
source = ref s
|
source = ref s
|
||||||
|
@ -79,30 +84,34 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
||||||
source := add(normalize=false, [amplify(0.00001, noise()),s])
|
source := add(normalize=false, [amplify(0.00001, noise()),s])
|
||||||
end
|
end
|
||||||
if bitrate == 24 then
|
if bitrate == 24 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 24),!source))
|
ignore(output(%vorbis.cbr(bitrate = 24),!source))
|
||||||
elsif bitrate == 32 then
|
elsif bitrate == 32 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 32),!source))
|
ignore(output(%vorbis.cbr(bitrate = 32),!source))
|
||||||
elsif bitrate == 48 then
|
elsif bitrate == 48 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 48),!source))
|
ignore(output(%vorbis.cbr(bitrate = 48),!source))
|
||||||
elsif bitrate == 64 then
|
elsif bitrate == 64 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 64),!source))
|
ignore(output(%vorbis.cbr(bitrate = 64),!source))
|
||||||
elsif bitrate == 96 then
|
elsif bitrate == 96 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 96),!source))
|
ignore(output(%vorbis.cbr(bitrate = 96),!source))
|
||||||
elsif bitrate == 128 then
|
elsif bitrate == 128 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 128),!source))
|
ignore(output(%vorbis.cbr(bitrate = 128),!source))
|
||||||
elsif bitrate == 160 then
|
elsif bitrate == 160 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 160),!source))
|
ignore(output(%vorbis.cbr(bitrate = 160),!source))
|
||||||
elsif bitrate == 192 then
|
elsif bitrate == 192 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 192),!source))
|
ignore(output(%vorbis.cbr(bitrate = 192),!source))
|
||||||
elsif bitrate == 224 then
|
elsif bitrate == 224 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 224),!source))
|
ignore(output(%vorbis.cbr(bitrate = 224),!source))
|
||||||
elsif bitrate == 256 then
|
elsif bitrate == 256 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 256),!source))
|
ignore(output(%vorbis.cbr(bitrate = 256),!source))
|
||||||
elsif bitrate == 320 then
|
elsif bitrate == 320 then
|
||||||
ignore(output.icecast(%vorbis.cbr(bitrate = 320),!source))
|
ignore(output(%vorbis.cbr(bitrate = 320),!source))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
user_ref = ref user
|
||||||
|
if user == "" then
|
||||||
|
user_ref := "source"
|
||||||
|
end
|
||||||
output.shoutcast = output.shoutcast(host = host,
|
output.shoutcast = output.shoutcast(host = host,
|
||||||
port = port,
|
port = port,
|
||||||
password = pass,
|
password = pass,
|
||||||
|
@ -111,7 +120,8 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
||||||
restart_delay = 5,
|
restart_delay = 5,
|
||||||
url = url,
|
url = url,
|
||||||
genre = genre,
|
genre = genre,
|
||||||
name = description)
|
name = description,
|
||||||
|
user = !user_ref)
|
||||||
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
|
||||||
|
|
|
@ -56,18 +56,18 @@ if output_sound_device then
|
||||||
ignore(output.alsa(s))
|
ignore(output.alsa(s))
|
||||||
end
|
end
|
||||||
|
|
||||||
if output_s1 != "disabled" then
|
if s1_output != "disabled" then
|
||||||
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
||||||
output_to(output_s1, s1_type, s1_bitrate, s1_host, s1_port, s1_pass, s1_mount, s1_url, s1_description, s1_genre, s)
|
output_to(s1_output, s1_type, s1_bitrate, s1_host, s1_port, s1_pass, s1_mount, s1_url, s1_description, s1_genre, s1_user, s)
|
||||||
end
|
end
|
||||||
|
|
||||||
if output_s2 != "disabled" then
|
if s2_output != "disabled" then
|
||||||
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
||||||
output_to(output_s2, s2_type, s2_bitrate, s2_host, s2_port, s2_pass, s2_mount, s2_url, s2_description, s2_genre, s)
|
output_to(s2_output, s2_type, s2_bitrate, s2_host, s2_port, s2_pass, s2_mount, s2_url, s2_description, s2_genre, s2_user, s)
|
||||||
end
|
end
|
||||||
|
|
||||||
if output_s3 != "disabled" then
|
if s3_output != "disabled" then
|
||||||
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
#output_to(output_type, type, bitrate, host, port, pass, mount_point, url, description, genre, s)
|
||||||
output_to(output_s3, s3_type, s3_bitrate, s3_host, s3_port, s3_pass, s3_mount, s3_url, s3_description, s3_genre, s)
|
output_to(s3_output, s3_type, s3_bitrate, s3_host, s3_port, s3_pass, s3_mount, s3_url, s3_description, s3_genre, s3_user, s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -139,25 +139,22 @@ class PypoFetch(Thread):
|
||||||
|
|
||||||
# look for changes
|
# look for changes
|
||||||
for s in setting:
|
for s in setting:
|
||||||
if "output_" in s[u'keyname'] and s[u'keyname'] != "output_icecast_vorbis_metadata" and s[u'keyname'] != "output_sound_device":
|
if "output_sound_device" in s[u'keyname']:
|
||||||
dump, stream = s[u'keyname'].split('_', 1)
|
dump, stream = s[u'keyname'].split('_', 1)
|
||||||
state_change_restart[stream] = False
|
state_change_restart[stream] = False
|
||||||
# This is the case where restart is required no matter what
|
# This is the case where restart is required no matter what
|
||||||
if (existing[s[u'keyname']] != s[u'value']):
|
if (existing[s[u'keyname']] != s[u'value']):
|
||||||
logger.info("'Need-to-restart' state detected for %s...", s[u'keyname'])
|
logger.info("'Need-to-restart' state detected for %s...", s[u'keyname'])
|
||||||
restart = True;
|
restart = True;
|
||||||
# This is the case where we need further checking
|
|
||||||
if s[u'value'] != 'disabled':
|
|
||||||
state_change_restart[stream] = True
|
|
||||||
else:
|
else:
|
||||||
if s[u'keyname'] == "output_sound_device":
|
stream, dump = s[u'keyname'].split('_',1)
|
||||||
dump, stream = s[u'keyname'].split('_',1)
|
if "_output" in s[u'keyname']:
|
||||||
state_change_restart[stream] = False
|
if (existing[s[u'keyname']] != s[u'value']):
|
||||||
if not (s[u'value'] == existing[s[u'keyname']]):
|
|
||||||
logger.info("'Need-to-restart' state detected for %s...", s[u'keyname'])
|
logger.info("'Need-to-restart' state detected for %s...", s[u'keyname'])
|
||||||
|
restart = True;
|
||||||
|
elif ( s[u'value'] != 'disabled'):
|
||||||
state_change_restart[stream] = True
|
state_change_restart[stream] = True
|
||||||
elif s[u'keyname'] != "output_icecast_vorbis_metadata" and s[u'keyname'] != "log_file":
|
else:
|
||||||
stream, dump = s[u'keyname'].split('_',1)
|
|
||||||
# setting inital value
|
# setting inital value
|
||||||
if stream not in change:
|
if stream not in change:
|
||||||
change[stream] = False
|
change[stream] = False
|
||||||
|
@ -195,6 +192,8 @@ class PypoFetch(Thread):
|
||||||
buffer += temp
|
buffer += temp
|
||||||
buffer += "\n"
|
buffer += "\n"
|
||||||
fh.write(buffer)
|
fh.write(buffer)
|
||||||
|
fh.write("output_icecast_vorbis_metadata = false\n");
|
||||||
|
fh.write("log_file = \"/var/log/airtime/pypo-liquidsoap/<script>.log\"\n");
|
||||||
fh.close()
|
fh.close()
|
||||||
# restarting pypo.
|
# restarting pypo.
|
||||||
# we could just restart liquidsoap but it take more time somehow.
|
# we could just restart liquidsoap but it take more time somehow.
|
||||||
|
|
Loading…
Reference in New Issue