diff --git a/app/frontend.py b/app/frontend.py index d0993918..12cd8096 100644 --- a/app/frontend.py +++ b/app/frontend.py @@ -2,7 +2,7 @@ import time from functools import wraps from pathlib import Path -from urllib.parse import quote_plus +from urllib.parse import quote_plus, urlparse from flask import ( Flask, @@ -17,6 +17,7 @@ from wyze_bridge import WyzeBridge from wyzebridge import config, web_ui from wyzebridge.auth import WbAuth +from wyzebridge.bridge_utils import env_bool from wyzebridge.web_ui import url_for @@ -249,7 +250,8 @@ def iptv_playlist(): Generate an m3u8 playlist with all enabled cameras. """ cameras = web_ui.format_streams(wb.streams.get_all_cam_info()) - resp = make_response(render_template("m3u8.html", cameras=cameras)) + hostname = env_bool("DOMAIN", urlparse(request.root_url).hostname or "localhost") + resp = make_response(render_template("m3u8.html", cameras=cameras, hostname=hostname)) resp.headers.set("content-type", "application/x-mpegURL") return resp diff --git a/app/templates/m3u8.html b/app/templates/m3u8.html index a248d642..9d1873f3 100644 --- a/app/templates/m3u8.html +++ b/app/templates/m3u8.html @@ -1,5 +1,5 @@ #EXTM3U {% for name,camera in cameras.items() %}{% if camera.enabled %} -#EXTINF:-1 channel-id="{{name}}" tvc-guide-genres="{{camera.product_model}}", {{name}} +#EXTINF:-1 channel-id="{{name}}" tvc-guide-genres="{{camera.product_model}}, {{camera.model_name}}" tvc-guide-tags="Cam, Live" tvc-guide-title="{{camera.nickname}}" tvc-guide-description=="Live {{camera.nickname}}" tvc-guide-art="{{hostname}}:5000/{{camera.img_url}}", {{name}} {{ camera.hls_url }}stream.m3u8 {% endif %}{% endfor %} \ No newline at end of file