strix

A simple web UI for motion
git clone https://www.brianlane.com/git/strix
Log | Files | Refs | LICENSE

commit 91e050a8c84cdda5edf4abd902c650ec5036827b
parent 85252ee9bc33009157d46874ecd508ec6b895f16
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Fri,  9 Apr 2021 07:40:12 -0700

events: Search for m4v, webm, mp4, and ogg videos

Support all the different video types that have been used.
Current format is m4v

Diffstat:
Msrc/strix/events.py | 26+++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/strix/events.py b/src/strix/events.py @@ -69,19 +69,15 @@ def event_details(log: structlog.BoundLogger, event_path: str) -> Dict: start_time = datetime.now() end_time = datetime.now() - if os.path.exists(event_path+"/video.ogg"): - video = url+"/video.ogg" - elif os.path.exists(event_path+"/video.webm"): - video = url+"/video.webm" - else: - video = "images/missing.jpg" - - if os.path.exists(event_path+"/debug/video.ogg"): - debug_video = url+"/debug/video.ogg" - elif os.path.exists(event_path+"/debug/video.webm"): - debug_video = url+"/debug/video.webm" - else: - debug_video = "images/missing.jpg" + # Find the videos, if they exist + video = [] + for pth in [event_path, event_path+"/debug"]: + for ext in ["m4v", "webm", "mp4", "ogg"]: + if os.path.exists(pth+"/video."+ext): + video.append(url+"/video."+ext) + break + else: + video.append("images/missing.jpg") is_saved = os.path.exists(event_path+"/.saved") @@ -91,8 +87,8 @@ def event_details(log: structlog.BoundLogger, event_path: str) -> Dict: return { "start": str(start_time), "end": str(end_time), - "video": video, - "debug_video": debug_video, + "video": video[0], + "debug_video": video[1], "thumbnail": thumbnail, "images": [], "saved": is_saved