Merge branch '2.3.x' into 2.3.x-saas

Conflicts:
	airtime_mvc/application/controllers/SystemstatusController.php
This commit is contained in:
Martin Konecny 2013-03-06 13:47:21 -05:00
commit 43ffa2aece
23 changed files with 394 additions and 118 deletions

View file

@ -15,7 +15,7 @@ import json
import base64
from configobj import ConfigObj
AIRTIME_VERSION = "2.3.0"
AIRTIME_VERSION = "2.3.1"
# TODO : Place these functions in some common module. Right now, media

View file

@ -13,5 +13,7 @@ try:
print "OK"
else:
print "Wasn't running"
subprocess.call("update-rc.d -f airtime-media-monitor remove".split(" "))
except Exception, e:
print e

View file

@ -17,15 +17,7 @@ DAEMON=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
PIDFILE=/var/run/airtime-liquidsoap.pid
start () {
chown pypo:pypo /var/log/airtime/pypo
chown pypo:pypo /var/log/airtime/pypo-liquidsoap
touch /var/run/airtime-liquidsoap.pid
chown pypo:pypo /var/run/airtime-liquidsoap.pid
start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
--pidfile /var/run/airtime-liquidsoap.pid --nicelevel -15 --startas $DAEMON
start_no_monit
monit monitor airtime-liquidsoap >/dev/null 2>&1
}
@ -39,7 +31,14 @@ stop () {
}
start_no_monit() {
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
chown pypo:pypo /var/log/airtime/pypo
chown pypo:pypo /var/log/airtime/pypo-liquidsoap
touch /var/run/airtime-liquidsoap.pid
chown pypo:pypo /var/run/airtime-liquidsoap.pid
start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
--pidfile /var/run/airtime-liquidsoap.pid --nicelevel -15 --startas $DAEMON
}

View file

@ -6,7 +6,7 @@ if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
try:
try:
#stop pypo and liquidsoap processes
print "Waiting for Pypo process to stop...",
try:
@ -18,12 +18,16 @@ try:
print "OK"
else:
print "Wasn't running"
print "Waiting for Liquidsoap process to stop...",
if (os.path.exists('/etc/init.d/airtime-liquidsoap')):
subprocess.call("invoke-rc.d airtime-liquidsoap stop", shell=True)
print "OK"
else:
print "Wasn't running"
subprocess.call("update-rc.d -f airtime-playout remove".split(" "))
subprocess.call("update-rc.d -f airtime-liquidsoap remove".split(" "))
except Exception, e:
print e

View file

@ -1,59 +0,0 @@
# -*- coding: utf-8 -*-
import os
import sys
from configobj import ConfigObj
if os.geteuid() != 0:
print "Please run this as root."
sys.exit(1)
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
def remove_path(path):
os.system('rm -rf "%s"' % path)
def get_current_script_dir():
current_script_dir = os.path.realpath(__file__)
index = current_script_dir.rindex('/')
return current_script_dir[0:index]
def remove_monit_file():
os.system("rm -f /etc/monit/conf.d/monit-airtime-playout.cfg")
os.system("rm -f /etc/monit/conf.d/monit-airtime-liquidsoap.cfg")
try:
# load config file
try:
config = ConfigObj(PATH_INI_FILE)
except Exception, e:
print 'Error loading config file: ', e
sys.exit(1)
os.system("invoke-rc.d airtime-playout stop")
os.system("invoke-rc.d airtime-liquidsoap stop")
os.system("rm -f /etc/init.d/airtime-playout")
os.system("rm -f /etc/init.d/airtime-liquidsoap")
os.system("update-rc.d -f airtime-playout remove >/dev/null 2>&1")
os.system("update-rc.d -f airtime-liquidsoap remove >/dev/null 2>&1")
#remove logrotate script
os.system("rm -f /etc/logrotate.d/airtime-liquidsoap")
print "Removing monit file"
remove_monit_file()
print "Removing cache directories"
remove_path(config["cache_base_dir"])
print "Removing symlinks"
os.system("rm -f /usr/bin/airtime-liquidsoap")
print "Removing pypo files"
remove_path(config["bin_dir"])
print "Pypo uninstall complete."
except Exception, e:
print "exception:" + str(e)

View file

@ -1,6 +1,6 @@
def notify(m)
#current_media_id := string_of(m['schedule_table_id'])
command = "/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --data='#{!pypo_data}' --media-id=#{m['schedule_table_id']} &"
command = "/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --media-id=#{m['schedule_table_id']} &"
log(command)
system(command)
end
@ -78,14 +78,16 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
source = ref s
def on_error(msg)
connected := "false"
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream} --time=#{!time} &")
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream} --time=#{!time} &")
command = "/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --error='#{msg}' --stream-id=#{stream} --time=#{!time} &"
system(command)
log(command)
5.
end
def on_connect()
connected := "true"
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --connect --stream-id=#{stream} --time=#{!time} &")
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --connect --stream-id=#{stream} --time=#{!time} &")
command = "/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --connect --stream-id=#{stream} --time=#{!time} &"
system(command)
log(command)
end
stereo = (channels == "stereo")

View file

@ -154,8 +154,9 @@ def make_scheduled_play_unavailable()
end
def update_source_status(sourcename, status) =
system("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --source-name=#{sourcename} --source-status=#{status} &")
log("/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --source-name=#{sourcename} --source-status=#{status} &")
command = "/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --source-name=#{sourcename} --source-status=#{status} &"
system(command)
log(command)
end
def live_dj_connect(header) =

View file

@ -12,5 +12,5 @@
if failed host localhost port 1234
send "version\r\nexit\r\n"
expect "Liquidsoap"
retry 3
with timeout 2 seconds retry 3 for 2 cycles
then restart