Added RTSP streams report to API

This commit is contained in:
Jono Targett 2023-06-13 18:52:51 +09:30
parent 3f6705ce75
commit dd216e54d3
2 changed files with 24 additions and 3 deletions

View File

@ -38,10 +38,10 @@ udpMaxPayloadSize: 1472
externalAuthenticationURL:
# Enable the HTTP API.
api: no
api: yes
# Enable Prometheus-compatible metrics.
metrics: no
metrics: yes
# Enable pprof-compatible endpoint to monitor performances.
pprof: no

View File

@ -1,5 +1,6 @@
#! /usr/bin/env python3
import requests
import SoapySDR as soapy
from radio import Radio
from tuuube import Tuuube
@ -13,9 +14,29 @@ swag = Swagger(app)
radios = {}
@app.route('/report')
def report():
"""Get streams report from the RTSP relay.
---
responses:
200:
description: JSON
"""
try:
r = requests.get("http://localhost:9997/v1/paths/list")
j = r.json()
for item in j['items']:
del j['items'][item]['conf']
del j['items'][item]['confName']
return jsonify(j)
except:
return "Shat the bed", 500
@app.route('/radio/report')
def report():
def radio_report():
"""List radio devices available to the system.
---
responses: