vod-rtmp/frontend/app/frontend.py

35 lines
891 B
Python
Raw Normal View History

2021-10-10 18:57:54 -04:00
#!/usr/bin/env python3
# imports
import flask
import urllib
from zomstream import Zomstream
streamList = []
zomstream = Zomstream()
frontend = flask.Blueprint('frontend', __name__)
@frontend.route("/")
def start():
mainTemplate = '%s/main.html.j2' % zomstream.configuration['template_folder']
streamList = zomstream.getStreamNames()
page = flask.render_template(
mainTemplate,
items=streamList,
configuration=zomstream.configuration
)
return page
2021-10-12 13:19:18 -04:00
@frontend.route("/player/<appname>/<streamname>")
2021-10-12 12:46:24 -04:00
def show_player(appname, hlsindex):
2021-10-10 18:57:54 -04:00
playerTemplate = '%s/player.html.j2' % zomstream.configuration['template_folder']
2021-10-12 13:19:18 -04:00
hlsindex = streamname.split('_')[0]
2021-10-10 18:57:54 -04:00
page = flask.render_template(
playerTemplate,
appname=appname,
2021-10-12 13:15:12 -04:00
hlsindex=hlsindex,
2021-10-10 18:57:54 -04:00
configuration=zomstream.configuration
)
return page