def liquidsoap_shutdown(): try: client = LiquidDaemonClient() client.connect() client.shutdown_daemon() client.close() return jsonify({'status': 'done'}) except Exception as e: return jsonify({'error': str(e)})
def liquidsoap_log(): try: client = LiquidDaemonClient() client.connect() offset = request.args.get('offset') if offset is not None: offset = int(offset) offset, log = client.get_log(offset) client.close() lines = [] for line in log: ts = to_user_timezone(datetime.utcfromtimestamp(int(line[0]))) lines.append((ts.isoformat(), line[3])) return jsonify({'log': lines, 'offset': offset}) except Exception as e: return jsonify({'error': str(e)})