Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
7e1efe5d96
|
@ -191,6 +191,30 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
|
|||
$user->setAttrib('alt', 'regular_text');
|
||||
$this->addElement($user);
|
||||
|
||||
$adminUser = new Zend_Form_Element_Text('admin_user');
|
||||
$adminUser->setLabel(_("Admin User"))
|
||||
->setValue(Application_Model_StreamSetting::getAdminUser($prefix))
|
||||
->setValidators(array(
|
||||
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if ($disable_all) {
|
||||
$adminUser->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$adminUser->setAttrib('alt', 'regular_text');
|
||||
$this->addElement($adminUser);
|
||||
|
||||
$adminPass = new Zend_Form_Element_Text('admin_pass');
|
||||
$adminPass->setLabel(_("Admin Password"))
|
||||
->setValue(Application_Model_StreamSetting::getAdminPass($prefix))
|
||||
->setValidators(array(
|
||||
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if ($disable_all) {
|
||||
$adminPass->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$adminPass->setAttrib('alt', 'regular_text');
|
||||
$this->addElement($adminPass);
|
||||
|
||||
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>'._('Getting information from the server...').'</h3></div>';
|
||||
|
||||
$this->setDecorators(array(
|
||||
|
|
|
@ -163,7 +163,7 @@ class Application_Model_StreamSetting
|
|||
$con = Propel::getConnection();
|
||||
$sql = "SELECT *"
|
||||
." FROM cc_stream_setting"
|
||||
." WHERE keyname not like '%_error'";
|
||||
." WHERE keyname not like '%_error' AND keyname not like '%_admin_%'";
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
|
||||
|
@ -433,4 +433,20 @@ class Application_Model_StreamSetting
|
|||
{
|
||||
return self::getValue("dj_live_stream_mp");
|
||||
}
|
||||
|
||||
public static function getAdminUser($stream){
|
||||
return self::getValue($stream."_admin_user");
|
||||
}
|
||||
|
||||
public static function setAdminUser($stream, $v){
|
||||
self::setValue($stream."_admin_user", $v, "string");
|
||||
}
|
||||
|
||||
public static function getAdminPass($stream){
|
||||
return self::getValue($stream."_admin_pass");
|
||||
}
|
||||
|
||||
public static function setAdminPass($stream, $v){
|
||||
self::setValue($stream."_admin_pass", $v, "string");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,6 +104,34 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="adminUser-label">
|
||||
<label for="outputUser"><?php echo $this->element->getElement('admin_user')->getLabel()?> :
|
||||
<span class='admin_username_help_icon'></span>
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="adminUser-element">
|
||||
<?php echo $this->element->getElement('admin_user')?>
|
||||
<?php if($this->element->getElement('admin_user')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('admin_user')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="adminPassword-label">
|
||||
<label class="optional" for="outputPassword"><?php echo $this->element->getElement('admin_pass')->getLabel()?> :</label>
|
||||
</dt>
|
||||
<dd id="adminPassword-element" class="clearfix">
|
||||
<?php echo $this->element->getElement('admin_pass')?>
|
||||
<?php if($this->element->getElement('admin_pass')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('admin_pass')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt class="block-display info-block">
|
||||
<?php echo _("The following info will be displayed to listeners in their media player:")?>
|
||||
</dt>
|
||||
|
|
|
@ -25,6 +25,8 @@ INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_host', '1
|
|||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_port', '8000', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_pass', 'hackme', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_admin_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_mount', 'airtime_128', '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_description', 'Airtime Radio! Stream #1', 'string');
|
||||
|
@ -38,6 +40,8 @@ INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', ''
|
|||
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_admin_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_admin_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');
|
||||
|
@ -51,6 +55,8 @@ INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', ''
|
|||
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_admin_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_admin_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');
|
||||
|
|
|
@ -109,7 +109,8 @@ select {
|
|||
}
|
||||
|
||||
.airtime_auth_help_icon, .custom_auth_help_icon, .stream_username_help_icon,
|
||||
.playlist_type_help_icon, .master_username_help_icon, .repeat_tracks_help_icon{
|
||||
.playlist_type_help_icon, .master_username_help_icon, .repeat_tracks_help_icon,
|
||||
.admin_username_help_icon {
|
||||
cursor: help;
|
||||
position: relative;
|
||||
display:inline-block; zoom:1;
|
||||
|
|
|
@ -355,6 +355,27 @@ function setupEventListeners() {
|
|||
},
|
||||
})
|
||||
|
||||
$(".admin_username_help_icon").qtip({
|
||||
content: {
|
||||
text: $.i18n._("This admin username and password for Icecast to get listener statistics.")
|
||||
},
|
||||
hide: {
|
||||
delay: 500,
|
||||
fixed: true
|
||||
},
|
||||
style: {
|
||||
border: {
|
||||
width: 0,
|
||||
radius: 4
|
||||
},
|
||||
classes: "ui-tooltip-dark ui-tooltip-rounded"
|
||||
},
|
||||
position: {
|
||||
my: "left bottom",
|
||||
at: "right center"
|
||||
},
|
||||
})
|
||||
|
||||
$(".master_username_help_icon").qtip({
|
||||
content: {
|
||||
text: $.i18n._("If your live streaming client does not ask for a username, this field should be 'source'.")
|
||||
|
|
|
@ -31,7 +31,7 @@ class ListenerStat(Thread):
|
|||
|
||||
|
||||
def get_icecast_xml(self, ip):
|
||||
encoded = base64.b64encode("%(admin_user)s:%(admin_password)s" % ip)
|
||||
encoded = base64.b64encode("%(admin_user)s:%(admin_pass)s" % ip)
|
||||
|
||||
header = {"Authorization":"Basic %s" % encoded}
|
||||
self.logger.debug(ip)
|
||||
|
@ -78,8 +78,6 @@ class ListenerStat(Thread):
|
|||
#streams are the same server, we will still initiate 3 separate
|
||||
#connections
|
||||
for k, v in stream_parameters.items():
|
||||
v["admin_user"] = "admin"
|
||||
v["admin_password"] = "hackme"
|
||||
if v["enable"] == 'true':
|
||||
stats.append(self.get_icecast_stats(v))
|
||||
#stats.append(get_shoutcast_stats(ip))
|
||||
|
@ -103,8 +101,7 @@ class ListenerStat(Thread):
|
|||
|
||||
self.push_stream_stats(stats)
|
||||
except Exception, e:
|
||||
top = traceback.format_exc()
|
||||
self.logger.error('Exception: %s', top)
|
||||
self.logger.error('Exception: %s', e)
|
||||
|
||||
time.sleep(120)
|
||||
|
||||
|
|
|
@ -188,28 +188,6 @@ class PypoFetch(Thread):
|
|||
self.update_liquidsoap_station_name(info['station_name'])
|
||||
self.update_liquidsoap_transition_fade(info['transition_fade'])
|
||||
|
||||
def write_liquidsoap_config(self, setting):
|
||||
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
|
||||
self.logger.info("Rewriting liquidsoap.cfg...")
|
||||
fh.write("################################################\n")
|
||||
fh.write("# THIS FILE IS AUTO GENERATED. DO NOT CHANGE!! #\n")
|
||||
fh.write("################################################\n")
|
||||
for k, d in setting:
|
||||
buffer_str = d[u'keyname'] + " = "
|
||||
if d[u'type'] == 'string':
|
||||
temp = d[u'value']
|
||||
buffer_str += '"%s"' % temp
|
||||
else:
|
||||
temp = d[u'value']
|
||||
if temp == "":
|
||||
temp = "0"
|
||||
buffer_str += temp
|
||||
|
||||
buffer_str += "\n"
|
||||
fh.write(api_client.encode_to(buffer_str))
|
||||
fh.write("log_file = \"/var/log/airtime/pypo-liquidsoap/<script>.log\"\n");
|
||||
fh.close()
|
||||
|
||||
def restart_liquidsoap(self):
|
||||
|
||||
self.telnet_lock.acquire()
|
||||
|
|
Loading…
Reference in New Issue