def liquidsoap_status(): try: ret = {} li = LiquidInterface() li.connect() ret['version'] = li.get_version() ret['uptime'] = li.get_uptime() ret['sources'] = [] for source in li.get_sources(): ret['sources'].append({ 'handler': source.handler, 'type': source.type, 'status': (source.status() != 'no source client connected'), 'status_msg': source.status() }) ret['sinks'] = [] for sink in li.get_sinks(): ret['sinks'].append({ 'handler': sink.handler, 'type': sink.type, 'status': (sink.status() == 'on') }) li.close() return jsonify(ret) except Exception as e: return jsonify({'error': str(e)})
def kick(): """shorthand method for kicking the currently connected user returns True if someone was kicked """ liquidsoap = LiquidInterface() liquidsoap.connect() kicked = False for source in liquidsoap.get_sources(): if source.status() != 'no source client connected': source.kick() kicked = True liquidsoap.close() return kicked
def liquidsoap_status(): try: ret = {} li = LiquidInterface() li.connect() ret['version'] = li.get_version() ret['uptime'] = li.get_uptime() ret['sources'] = [] for source in li.get_sources(): ret['sources'].append({'handler': source.handler, 'type': source.type, 'status': (source.status() != 'no source client connected'), 'status_msg':source.status()}) ret['sinks'] = [] for sink in li.get_sinks(): ret['sinks'].append({'handler': sink.handler, 'type': sink.type, 'status': (sink.status() == 'on')}) li.close() return jsonify(ret) except Exception as e: return jsonify({'error': str(e)})