Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more details to the cams.m3u8 endpoint #1425

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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


Expand Down Expand Up @@ -248,8 +249,9 @@ def iptv_playlist():
"""
Generate an m3u8 playlist with all enabled cameras.
"""
hostname = request.host.split(":")[0]
cameras = web_ui.format_streams(wb.streams.get_all_cam_info())
resp = make_response(render_template("m3u8.html", cameras=cameras))
resp = make_response(render_template("m3u8.html", cameras=cameras, hostname=hostname))
resp.headers.set("content-type", "application/x-mpegURL")
return resp

Expand Down
2 changes: 1 addition & 1 deletion app/templates/m3u8.html
Original file line number Diff line number Diff line change
@@ -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 %}