CC-5049:
Error messages on Liquidsoap start up/shut down after Airtime install Suppress global warning messages. Clients should decide whether to print or not.
This commit is contained in:
parent
16bd407136
commit
ca37ec3aff
2 changed files with 11 additions and 8 deletions
|
@ -138,8 +138,8 @@ class ApiRequest(object):
|
||||||
content_type = f.info().getheader('Content-Type')
|
content_type = f.info().getheader('Content-Type')
|
||||||
response = f.read()
|
response = f.read()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error('Exception: %s', e)
|
#self.logger.error('Exception: %s', e)
|
||||||
self.logger.error("traceback: %s", traceback.format_exc())
|
#self.logger.error("traceback: %s", traceback.format_exc())
|
||||||
raise
|
raise
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -149,8 +149,8 @@ class ApiRequest(object):
|
||||||
else:
|
else:
|
||||||
raise InvalidContentType()
|
raise InvalidContentType()
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.error(response)
|
#self.logger.error(response)
|
||||||
self.logger.error("traceback: %s", traceback.format_exc())
|
#self.logger.error("traceback: %s", traceback.format_exc())
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def req(self, *args, **kwargs):
|
def req(self, *args, **kwargs):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
from api_clients.api_client import AirtimeApiClient
|
from api_clients.api_client import AirtimeApiClient
|
||||||
|
|
||||||
def generate_liquidsoap_config(ss):
|
def generate_liquidsoap_config(ss):
|
||||||
|
@ -26,19 +27,21 @@ def generate_liquidsoap_config(ss):
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
logging.basicConfig(format='%(message)s')
|
logging.basicConfig(format='%(message)s')
|
||||||
ac = AirtimeApiClient(logging.getLogger())
|
|
||||||
attempts = 0
|
attempts = 0
|
||||||
max_attempts = 5
|
max_attempts = 10
|
||||||
|
successful = False
|
||||||
|
|
||||||
while True:
|
while not successful:
|
||||||
try:
|
try:
|
||||||
|
ac = AirtimeApiClient(logging.getLogger())
|
||||||
ss = ac.get_stream_setting()
|
ss = ac.get_stream_setting()
|
||||||
generate_liquidsoap_config(ss)
|
generate_liquidsoap_config(ss)
|
||||||
break
|
successful = True
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
if attempts == max_attempts:
|
if attempts == max_attempts:
|
||||||
print "Unable to connect to the Airtime server."
|
print "Unable to connect to the Airtime server."
|
||||||
logging.error(str(e))
|
logging.error(str(e))
|
||||||
|
logging.error("traceback: %s", traceback.format_exc())
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue