diff --git a/config/frontend/config.yml.dist b/config/frontend/config.yml.dist index 8bb1d43..2401e39 100644 --- a/config/frontend/config.yml.dist +++ b/config/frontend/config.yml.dist @@ -1,6 +1,6 @@ # This is the title and Subtitle displayed on the Head of the Page pagetitle: vod-rtmp -subtitle: v1 +subtitle: v0.69 # the footer footer: "© 2021 by the zom.bi Team" diff --git a/frontend/app/frontend.py b/frontend/app/frontend.py index 582995a..898a942 100644 --- a/frontend/app/frontend.py +++ b/frontend/app/frontend.py @@ -13,22 +13,48 @@ frontend = flask.Blueprint('frontend', __name__) @frontend.route("/") def start(): mainTemplate = '%s/main.html.j2' % zomstream.configuration['template_folder'] - streamList = zomstream.getStreamNames() + itemList = zomstream.getStreamNames() + + applications = [] + appnames = [] + for item in itemList: + if item[0] not in appnames: + appnames.append(item[0]) + + for appname in appnames: + streamnames = [] + for item in itemList: + streamitem=item[1].split('_')[0] + if streamitem not in streamnames and item[0] == appname: + streamnames.append(streamitem) + + streams = [] + for streamname in streamnames: + substreams = [] + for item in itemList: + if item[0] == appname: + if item[1].split('_')[0] == streamname: + substreams.append(item[1]) + stream = [streamname, substreams] + streams.append(stream) + + app = [appname, streams] + applications.append(app) + page = flask.render_template( mainTemplate, - items=streamList, + applications=applications, configuration=zomstream.configuration ) return page -@frontend.route("/player//") -def show_player(appname, hlsindex): +@frontend.route("/player//") +def show_player(appname, stream): playerTemplate = '%s/player.html.j2' % zomstream.configuration['template_folder'] - hlsindex = streamname.split('_')[0] page = flask.render_template( playerTemplate, appname=appname, - hlsindex=hlsindex, + stream=stream, configuration=zomstream.configuration ) return page diff --git a/frontend/app/templates/default/main.html.j2 b/frontend/app/templates/default/main.html.j2 index 18c8401..fc22180 100644 --- a/frontend/app/templates/default/main.html.j2 +++ b/frontend/app/templates/default/main.html.j2 @@ -11,34 +11,39 @@

{{ configuration["subtitle"] }}

-{% if items == [] %} +{% if applications == [] %}

There are currently no streams running

{% endif %} -{% for tem in items %} -
-

Stream {{ item[1] }}

- - - - - - - - - - - - - - - - - - -
ProtocolURL
RTMP substream }}rtmp://{{ configuration["rtmp_base"] }}/{{ item[0] }}/{{ item[2] }}
RTMP
HLS m3u8{{ configuration['web_proto'] }}://{{ configuration['base_url'] }}/hls/{{ item[1] }}/index.m3u8
HLS.js
-
+{% for application in applications %} +

{{ application[0] }}

+ {% for stream in application[1] %} +
+

stream {{ stream[0] }}

+ + + + + + + + {% for substream in stream[1] %} + + + + + + {% endfor %} + + + + + + +
ProtocolURL
RTMP {{ substream }}rtmp://{{ configuration["rtmp_base"] }}/{{ application[0] }}/{{ substream }}
RTMP
HLS m3u8{{ configuration['web_proto'] }}://{{ configuration['base_url'] }}/hls/{{ stream[0] }}.m3u8
HLS.js
+
+{% endfor %} {% endfor %}