Update IPFS playlist CID in database during streaming for live HLS
Some checks are pending
GPU Worker CI/CD / test (push) Waiting to run
GPU Worker CI/CD / deploy (push) Blocked by required conditions

- Add on_playlist_update callback to IPFSHLSOutput
- Pass callback through StreamInterpreter to output
- Update database with playlist CID as segments are created
- Enables live HLS redirect to IPFS before rendering completes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-04 00:23:49 +00:00
parent ed5ef2bf39
commit 9151d2c2a8
3 changed files with 33 additions and 1 deletions

View File

@@ -85,6 +85,9 @@ class StreamInterpreter:
# Error tracking
self.errors: List[str] = []
# Callback for live streaming (called when IPFS playlist is updated)
self.on_playlist_update: callable = None
def _resolve_name(self, name: str) -> Optional[Path]:
"""Resolve a friendly name to a file path using the naming service."""
try:
@@ -906,7 +909,8 @@ class StreamInterpreter:
hls_dir = output[:-9] # Remove /ipfs-hls suffix
import os
ipfs_gateway = os.environ.get("IPFS_GATEWAY_URL", "https://ipfs.io/ipfs")
out = IPFSHLSOutput(hls_dir, size=(w, h), fps=fps, audio_source=audio, ipfs_gateway=ipfs_gateway)
out = IPFSHLSOutput(hls_dir, size=(w, h), fps=fps, audio_source=audio, ipfs_gateway=ipfs_gateway,
on_playlist_update=self.on_playlist_update)
else:
out = FileOutput(output, size=(w, h), fps=fps, audio_source=audio)