Add subtitles and start offset to playvideo command
This commit is contained in:
14
main.py
14
main.py
@@ -150,8 +150,14 @@ async def control_endpoint(request: Request):
|
||||
|
||||
elif data['command'] == "playvideo" and 'filename' in data:
|
||||
filename = data['filename']
|
||||
await playvideo(filename)
|
||||
logger.info(f"Video playback requested: {filename}")
|
||||
subtitles = None
|
||||
seconds_from_start = 0
|
||||
if 'subtitles' in data:
|
||||
subtitles = data['subtitles']
|
||||
if 'secondsfromstart' in data:
|
||||
seconds_from_start = data['secondsfromstart']
|
||||
await playvideo(filename, subtitles, seconds_from_start)
|
||||
logger.info(f"Video playback requested: {filename} with subtitles {subtitles} starting {seconds_from_start} seconds from start.")
|
||||
|
||||
elif data['command'] == "seekvideo" and 'timestamp' in data:
|
||||
timestamp = data['timestamp']
|
||||
@@ -301,8 +307,8 @@ async def setscreen_single(ws: WebSocket, screen: str):
|
||||
async def setscreen(screen: str):
|
||||
return await manager.broadcast_binary({"type": "setscreen", "screen": screen})
|
||||
|
||||
async def playvideo(filename: str):
|
||||
return await manager.broadcast_binary({"type": "playvideo", "filename": filename})
|
||||
async def playvideo(filename: str, subtitles: str, seconds_from_start: int):
|
||||
return await manager.broadcast_binary({"type": "playvideo", "filename": filename, "subtitles": subtitles, "seconds_from_start": seconds_from_start})
|
||||
|
||||
async def seekvideo(timestamp: int):
|
||||
return await manager.broadcast_binary({"type": "seekvideo", "timestamp": timestamp})
|
||||
|
Reference in New Issue
Block a user