ensure pypo registers with server before doing Liquidsoap check

This commit is contained in:
Martin Konecny 2013-05-06 11:42:39 -04:00
parent ec7eb5f264
commit 3a1048bdec
1 changed files with 13 additions and 15 deletions

View File

@ -138,11 +138,10 @@ except Exception, e:
sys.exit(1)
class Global:
def __init__(self):
self.api_client = api_client.AirtimeApiClient()
def __init__(self, api_client):
self.api_client = api_client
def selfcheck(self):
self.api_client = api_client.AirtimeApiClient()
return self.api_client.is_server_compatible()
def test_api(self):
@ -186,12 +185,21 @@ if __name__ == '__main__':
signal.signal(signal.SIGINT, keyboardInterruptHandler)
# initialize
g = Global()
api_client = api_client.AirtimeApiClient()
g = Global(api_client)
while not g.selfcheck():
time.sleep(5)
success = False
while not success:
try:
api_client.register_component('pypo')
success = True
except Exception, e:
logger.error(str(e))
time.sleep(10)
telnet_lock = Lock()
ls_host = config['ls_host']
@ -204,20 +212,10 @@ if __name__ == '__main__':
g.test_api()
sys.exit(0)
api_client = api_client.AirtimeApiClient()
ReplayGainUpdater.start_reply_gain(api_client)
SilanAnalyzer.start_silan(api_client, logger)
success = False
while not success:
try:
api_client.register_component('pypo')
success = True
except Exception, e:
logger.error(str(e))
time.sleep(10)
pypoFetch_q = Queue()
recorder_q = Queue()
pypoPush_q = Queue()