Merge pull request #34 from ekimekim/gunner/restreamer/additional-routes

Added additional routes for listing available streams and variants.
pull/32/head
MasterGunner 6 years ago committed by GitHub
commit 96c1566d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -90,6 +90,28 @@ def metrics():
"""Return current metrics in prometheus metrics format"""
return prom.generate_latest()
@app.route('/files')
@stats
def list_streams():
"""Returns a JSON list of streams for which there may be segments available.
Returns empty list if no streams are available.
"""
path = app.static_folder
return json.dumps(listdir(path, error=False))
@app.route('/files/<stream>')
@stats
@has_path_args
def list_variants(stream):
"""Returns a JSON list of variants for the given stream for which there may
be segments available. Returns empty list on non-existent streams, etc.
"""
path = os.path.join(
app.static_folder,
stream,
)
return json.dumps(listdir(path, error=False))
@app.route('/files/<stream>/<variant>')
@stats

Loading…
Cancel
Save