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:
Martin Konecny 2013-05-23 17:17:00 -04:00
parent 16bd407136
commit ca37ec3aff
2 changed files with 11 additions and 8 deletions

View file

@ -138,8 +138,8 @@ class ApiRequest(object):
content_type = f.info().getheader('Content-Type')
response = f.read()
except Exception, e:
self.logger.error('Exception: %s', e)
self.logger.error("traceback: %s", traceback.format_exc())
#self.logger.error('Exception: %s', e)
#self.logger.error("traceback: %s", traceback.format_exc())
raise
try:
@ -149,8 +149,8 @@ class ApiRequest(object):
else:
raise InvalidContentType()
except Exception:
self.logger.error(response)
self.logger.error("traceback: %s", traceback.format_exc())
#self.logger.error(response)
#self.logger.error("traceback: %s", traceback.format_exc())
raise
def req(self, *args, **kwargs):

View file

@ -1,6 +1,7 @@
import logging
import sys
import time
import traceback
from api_clients.api_client import AirtimeApiClient
def generate_liquidsoap_config(ss):
@ -26,19 +27,21 @@ def generate_liquidsoap_config(ss):
fh.close()
logging.basicConfig(format='%(message)s')
ac = AirtimeApiClient(logging.getLogger())
attempts = 0
max_attempts = 5
max_attempts = 10
successful = False
while True:
while not successful:
try:
ac = AirtimeApiClient(logging.getLogger())
ss = ac.get_stream_setting()
generate_liquidsoap_config(ss)
break
successful = True
except Exception, e:
if attempts == max_attempts:
print "Unable to connect to the Airtime server."
logging.error(str(e))
logging.error("traceback: %s", traceback.format_exc())
sys.exit(1)
else:
time.sleep(3)