Merge branch '2.3.x' of dev.sourcefabric.org:airtime into 2.3.x
This commit is contained in:
commit
f2773fcb01
72 changed files with 8418 additions and 13592 deletions
|
@ -26,13 +26,10 @@ def generate_liquidsoap_config(ss):
|
|||
|
||||
logging.basicConfig(format='%(message)s')
|
||||
ac = AirtimeApiClient(logging.getLogger())
|
||||
ss = ac.get_stream_setting()
|
||||
|
||||
if ss is not None:
|
||||
try:
|
||||
generate_liquidsoap_config(ss)
|
||||
except Exception, e:
|
||||
logging.error(e)
|
||||
else:
|
||||
try:
|
||||
ss = ac.get_stream_setting()
|
||||
generate_liquidsoap_config(ss)
|
||||
except Exception, e:
|
||||
logging.error(str(e))
|
||||
print "Unable to connect to the Airtime server."
|
||||
sys.exit(1)
|
||||
|
|
|
@ -103,7 +103,10 @@ class ListenerStat(Thread):
|
|||
self.update_listener_stat_error(v["mount"], 'OK')
|
||||
except Exception, e:
|
||||
self.logger.error('Exception: %s', e)
|
||||
self.update_listener_stat_error(v["mount"], str(e))
|
||||
try:
|
||||
self.update_listener_stat_error(v["mount"], str(e))
|
||||
except Exception, e:
|
||||
self.logger.error('Exception: %s', e)
|
||||
|
||||
return stats
|
||||
|
||||
|
|
|
@ -69,15 +69,15 @@ class ReplayGainUpdater(Thread):
|
|||
self.logger.error(e)
|
||||
self.logger.debug(traceback.format_exc())
|
||||
def run(self):
|
||||
try:
|
||||
while True:
|
||||
self.logger.info("Runnning replaygain updater")
|
||||
while True:
|
||||
try:
|
||||
self.logger.info("Running replaygain updater")
|
||||
self.main()
|
||||
# Sleep for 5 minutes in case new files have been added
|
||||
time.sleep(60 * 5)
|
||||
except Exception, e:
|
||||
self.logger.error('ReplayGainUpdater Exception: %s', traceback.format_exc())
|
||||
self.logger.error(e)
|
||||
except Exception, e:
|
||||
self.logger.error('ReplayGainUpdater Exception: %s', traceback.format_exc())
|
||||
self.logger.error(e)
|
||||
time.sleep(60 * 5)
|
||||
|
||||
if __name__ == "__main__":
|
||||
rgu = ReplayGainUpdater()
|
||||
|
|
|
@ -179,7 +179,14 @@ if __name__ == '__main__':
|
|||
|
||||
ReplayGainUpdater.start_reply_gain(api_client)
|
||||
|
||||
api_client.register_component("pypo")
|
||||
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()
|
||||
|
|
|
@ -206,23 +206,25 @@ class PypoFetch(Thread):
|
|||
"""
|
||||
def set_bootstrap_variables(self):
|
||||
self.logger.debug('Getting information needed on bootstrap from Airtime')
|
||||
info = self.api_client.get_bootstrap_info()
|
||||
if info is None:
|
||||
try:
|
||||
info = self.api_client.get_bootstrap_info()
|
||||
except Exception, e:
|
||||
self.logger.error('Unable to get bootstrap info.. Exiting pypo...')
|
||||
else:
|
||||
self.logger.debug('info:%s', info)
|
||||
commands = []
|
||||
for k, v in info['switch_status'].iteritems():
|
||||
commands.append(self.switch_source_temp(k, v))
|
||||
self.logger.error(str(e))
|
||||
|
||||
stream_format = info['stream_label']
|
||||
station_name = info['station_name']
|
||||
fade = info['transition_fade']
|
||||
self.logger.debug('info:%s', info)
|
||||
commands = []
|
||||
for k, v in info['switch_status'].iteritems():
|
||||
commands.append(self.switch_source_temp(k, v))
|
||||
|
||||
commands.append(('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8'))
|
||||
commands.append(('vars.station_name %s\n' % station_name).encode('utf-8'))
|
||||
commands.append(('vars.default_dj_fade %s\n' % fade).encode('utf-8'))
|
||||
PypoFetch.telnet_send(self.logger, self.telnet_lock, commands)
|
||||
stream_format = info['stream_label']
|
||||
station_name = info['station_name']
|
||||
fade = info['transition_fade']
|
||||
|
||||
commands.append(('vars.stream_metadata_type %s\n' % stream_format).encode('utf-8'))
|
||||
commands.append(('vars.station_name %s\n' % station_name).encode('utf-8'))
|
||||
commands.append(('vars.default_dj_fade %s\n' % fade).encode('utf-8'))
|
||||
PypoFetch.telnet_send(self.logger, self.telnet_lock, commands)
|
||||
|
||||
def restart_liquidsoap(self):
|
||||
|
||||
|
|
|
@ -189,9 +189,17 @@ class Recorder(Thread):
|
|||
self.server_timezone = ''
|
||||
self.queue = q
|
||||
self.loops = 0
|
||||
self.api_client.register_component("show-recorder")
|
||||
self.logger.info("RecorderFetch: init complete")
|
||||
|
||||
success = False
|
||||
while not success:
|
||||
try:
|
||||
self.api_client.register_component('show-recorder')
|
||||
success = True
|
||||
except Exception, e:
|
||||
self.logger.error(str(e))
|
||||
time.sleep(10)
|
||||
|
||||
def handle_message(self):
|
||||
if not self.queue.empty():
|
||||
message = self.queue.get()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue