CC-3130: Disabling a Shoutcast stream causes the service type to revert back to Icecast
This happens because we use same field in the db to store whether stream is disabled, and which type is it (Icecast/Shoutcast). Thus when we disable a stream, we forget about the fact that it was set to Shoutcast before. Fixed by separating out the enable/disable state from stream type. Whether a stream is enabled/disabled is stored in new fields sx_enable. Stream type is stored in the old fields, sx_output.
This commit is contained in:
parent
85b8209db9
commit
53aecd1c00
|
@ -43,7 +43,7 @@ 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[$prefix.'_output'] != 'disabled'?1:0)
|
->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
if($disable_all){
|
if($disable_all){
|
||||||
$enable->setAttrib("disabled", "disabled");
|
$enable->setAttrib("disabled", "disabled");
|
||||||
|
|
|
@ -7,8 +7,8 @@ class Application_Model_StreamSetting {
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
$sql = "SELECT * "
|
$sql = "SELECT * "
|
||||||
."FROM cc_stream_setting "
|
."FROM cc_stream_setting "
|
||||||
."WHERE keyname LIKE '%_output' "
|
."WHERE keyname LIKE '%_enable' "
|
||||||
."AND value != 'disabled'";
|
."AND value == true";
|
||||||
|
|
||||||
$rows = $CC_DBC->getAll($sql);
|
$rows = $CC_DBC->getAll($sql);
|
||||||
$ids = array();
|
$ids = array();
|
||||||
|
@ -80,16 +80,13 @@ class Application_Model_StreamSetting {
|
||||||
$v = $d == 1?"true":"false";
|
$v = $d == 1?"true":"false";
|
||||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
|
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$temp = explode('_', $key);
|
$temp = explode('_', $key);
|
||||||
$prefix = $temp[0];
|
$prefix = $temp[0];
|
||||||
foreach ($d as $k=>$v) {
|
foreach ($d as $k=>$v) {
|
||||||
$keyname = $prefix . "_" . $k;
|
$keyname = $prefix . "_" . $k;
|
||||||
if( $k == 'output'){
|
if ($k == 'enable') {
|
||||||
if( $d["enable"] == 0){
|
$v = $d['enable'] == 1 ? 'true' : 'false';
|
||||||
$v = 'disabled';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$v = trim($v);
|
$v = trim($v);
|
||||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
||||||
|
@ -145,17 +142,15 @@ class Application_Model_StreamSetting {
|
||||||
public static function getStreamEnabled($stream_id){
|
public static function getStreamEnabled($stream_id){
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
|
|
||||||
$keyname = "s".$stream_id."_output";
|
$keyname = "s" . $stream_id . "_enable";
|
||||||
$sql = "SELECT value FROM cc_stream_setting"
|
$sql = "SELECT value FROM cc_stream_setting"
|
||||||
." WHERE keyname = '$keyname'";
|
." WHERE keyname = '$keyname'";
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
if ($result == 'false') {
|
||||||
if($result == 'disabled'){
|
|
||||||
$result = false;
|
$result = false;
|
||||||
} else {
|
} else {
|
||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ INSERT INTO cc_pref("keystr", "valstr") VALUES('plan_level', 'disabled');
|
||||||
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 ('icecast_vorbis_metadata', 'false', 'boolean');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
|
||||||
|
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_enable', 'true', 'boolean');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_output', 'icecast', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_output', 'icecast', '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 ('s1_bitrate', '128', 'integer');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_bitrate', '128', 'integer');
|
||||||
|
@ -22,7 +23,8 @@ INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_url', 'ht
|
||||||
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 ('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_enable', 'false', 'boolean');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_output', 'icecast', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_type', '', '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_bitrate', '', 'integer');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', '', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', '', 'string');
|
||||||
|
@ -34,7 +36,8 @@ INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_url', '',
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_description', '', '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_enable', 'false', 'boolean');
|
||||||
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_output', 'icecast', 'string');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_type', '', '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_bitrate', '', 'integer');
|
||||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', '', 'string');
|
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', '', 'string');
|
||||||
|
|
|
@ -164,6 +164,7 @@ class AirtimeDatabaseUpgrade{
|
||||||
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 ('icecast_vorbis_metadata', 'false', 'boolean');
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
|
||||||
|
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_enable', 'true', 'boolean');
|
||||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_output', 'icecast', 'string');
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_output', 'icecast', '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 ('s1_bitrate', '128', 'integer');
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_bitrate', '128', 'integer');
|
||||||
|
@ -176,7 +177,8 @@ class AirtimeDatabaseUpgrade{
|
||||||
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 ('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_enable', 'false', 'boolean');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_output', 'icecast', 'string');
|
||||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_type', '', '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_bitrate', '', 'integer');
|
||||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_host', '', 'string');
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_host', '', 'string');
|
||||||
|
@ -188,7 +190,8 @@ class AirtimeDatabaseUpgrade{
|
||||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_description', '', '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_enable', 'false', 'boolean');
|
||||||
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_output', 'icecast', 'string');
|
||||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_type', '', '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_bitrate', '', 'integer');
|
||||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_host', '', 'string');
|
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_host', '', 'string');
|
||||||
|
|
|
@ -7,8 +7,12 @@
|
||||||
###########################################
|
###########################################
|
||||||
output_sound_device = false
|
output_sound_device = false
|
||||||
s1_output = "icecast"
|
s1_output = "icecast"
|
||||||
s2_output = "disabled"
|
s2_output = "icecast"
|
||||||
s3_output = "disabled"
|
s3_output = "icecast"
|
||||||
|
|
||||||
|
s1_enable = true
|
||||||
|
s2_enable = false
|
||||||
|
s3_enable = false
|
||||||
|
|
||||||
s1_type = "ogg"
|
s1_type = "ogg"
|
||||||
s2_type = "ogg"
|
s2_type = "ogg"
|
||||||
|
|
|
@ -7,8 +7,12 @@
|
||||||
###########################################
|
###########################################
|
||||||
output_sound_device = false
|
output_sound_device = false
|
||||||
s1_output = "icecast"
|
s1_output = "icecast"
|
||||||
s2_output = "disabled"
|
s2_output = "icecast"
|
||||||
s3_output = "disabled"
|
s3_output = "icecast"
|
||||||
|
|
||||||
|
s1_enable = true
|
||||||
|
s2_enable = false
|
||||||
|
s3_enable = false
|
||||||
|
|
||||||
s1_type = "ogg"
|
s1_type = "ogg"
|
||||||
s2_type = "ogg"
|
s2_type = "ogg"
|
||||||
|
|
|
@ -54,18 +54,18 @@ if output_sound_device then
|
||||||
ignore(out(s))
|
ignore(out(s))
|
||||||
end
|
end
|
||||||
|
|
||||||
if s1_output != "disabled" then
|
if s1_enable == true 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(s1_output, s1_type, s1_bitrate, s1_host, s1_port, s1_pass, s1_mount, s1_url, s1_description, s1_genre, s1_user, s, "1")
|
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, "1")
|
||||||
end
|
end
|
||||||
|
|
||||||
if s2_output != "disabled" then
|
if s2_enable == true 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(s2_output, s2_type, s2_bitrate, s2_host, s2_port, s2_pass, s2_mount, s2_url, s2_description, s2_genre, s2_user, s, "2")
|
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, "2")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if s3_output != "disabled" then
|
if s3_enable == true 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(s3_output, s3_type, s3_bitrate, s3_host, s3_port, s3_pass, s3_mount, s3_url, s3_description, s3_genre, s3_user, s, "3")
|
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, "3")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue