Merge branch 'devel' into mediamonitor2

Conflicts:
	python_apps/api_clients/api_client.py
This commit is contained in:
Rudi Grinberg 2012-07-16 17:41:36 -04:00
commit 20e32b98ba
31 changed files with 253 additions and 143 deletions

View file

@ -73,7 +73,7 @@ monit_restart() {
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
rm -f $PIDFILE1
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE0 --startas $DAEMON0
start-stop-daemon --start --background --quiet --chuid $ROOTUSERID:$ROOTUSERID --make-pidfile --pidfile $PIDFILE0 --startas $DAEMON0
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
--nicelevel -15 --make-pidfile --pidfile $PIDFILE1 --startas $DAEMON1

View file

@ -1,6 +1,6 @@
import logging
import sys
from api_clients import api_client
from api_clients.api_client import AirtimeApiClient
def generate_liquidsoap_config(ss):
data = ss['msg']
@ -9,22 +9,22 @@ def generate_liquidsoap_config(ss):
fh.write("# THIS FILE IS AUTO GENERATED. DO NOT CHANGE!! #\n")
fh.write("################################################\n")
for d in data:
key = d['keyname']
str_buffer = d[u'keyname'] + " = "
if(d[u'type'] == 'string'):
temp = d[u'value']
str_buffer += '"%s"' % temp
val = '"%s"' % d['value']
else:
temp = d[u'value']
if(temp == ""):
temp = "0"
str_buffer += temp
str_buffer += "\n"
fh.write(api_client.encode_to(str_buffer))
val = d[u'value']
val = val if len(val) > 0 else "0"
str_buffer = "%s = %s\n" % (key, val)
fh.write(str_buffer.encode('utf-8'))
fh.write('log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"\n')
fh.close()
logging.basicConfig(format='%(message)s')
ac = api_client(logging.getLogger())
ac = AirtimeApiClient(logging.getLogger())
ss = ac.get_stream_setting()
if ss is not None:

View file

@ -1,7 +1,7 @@
from api_clients import *
import sys
api_clients = api_client.AirTimeApiClient()
api_clients = api_client.AirtimeApiClient()
dj_type = sys.argv[1]
username = sys.argv[2]

View file

@ -107,10 +107,10 @@ except Exception, e:
class Global:
def __init__(self):
self.api_client = api_client.AirTimeApiClient()
self.api_client = api_client.AirtimeApiClient()
def selfcheck(self):
self.api_client = api_client.AirTimeApiClient()
self.api_client = api_client.AirtimeApiClient()
return self.api_client.is_server_compatible()
def test_api(self):
@ -172,7 +172,7 @@ if __name__ == '__main__':
g.test_api()
sys.exit()
api_client = api_client.AirTimeApiClient()
api_client = api_client.AirtimeApiClient()
api_client.register_component("pypo")
pypoFetch_q = Queue()

View file

@ -40,7 +40,7 @@ except Exception, e:
class PypoFetch(Thread):
def __init__(self, pypoFetch_q, pypoPush_q, media_q, telnet_lock):
Thread.__init__(self)
self.api_client = api_client.AirTimeApiClient()
self.api_client = api_client.AirtimeApiClient()
self.fetch_queue = pypoFetch_q
self.push_queue = pypoPush_q
self.media_prepare_queue = media_q

View file

@ -64,7 +64,7 @@ except Exception, e:
class Notify:
def __init__(self):
self.api_client = api_client.AirTimeApiClient()
self.api_client = api_client.AirtimeApiClient()
def notify_media_start_playing(self, data, media_id):
logger = logging.getLogger("notify")

View file

@ -42,7 +42,7 @@ except Exception, e:
class PypoPush(Thread):
def __init__(self, q, telnet_lock):
Thread.__init__(self)
self.api_client = api_client.AirTimeApiClient()
self.api_client = api_client.AirtimeApiClient()
self.queue = q
self.telnet_lock = telnet_lock