diff --git a/thrimshim/thrimshim/main.py b/thrimshim/thrimshim/main.py index 2099026..0fbd897 100644 --- a/thrimshim/thrimshim/main.py +++ b/thrimshim/thrimshim/main.py @@ -12,12 +12,12 @@ import gevent import gevent.backdoor from gevent.pywsgi import WSGIServer import prometheus_client -import psycopg2 from psycopg2 import sql import common from common import database, dateutil from common.flask_stats import request_stats, after_request +from common.segments import KNOWN_XFADE_TRANSITIONS, CUSTOM_XFADE_TRANSITIONS import google.oauth2.id_token import google.auth.transport.requests @@ -144,6 +144,21 @@ def get_defaults(): }) +@app.route('/thrimshim/transitions') +@request_stats +def get_transitions(): + """Get info on available transitions. Returns a list of {name, description}.""" + items = [ + (name, description) for name, description in KNOWN_XFADE_TRANSITIONS.items() + ] + [ + (name, description) for name, (description, expr) in CUSTOM_XFADE_TRANSITIONS.items() + ] + return [ + {"name": name, "description": description} + for name, description in items + ] + + @app.route('/thrimshim/', methods=['GET']) @request_stats def get_row(ident):