Add CI/CD workflow
This commit is contained in:
@@ -59,7 +59,21 @@ class MultiResolutionHLSOutput:
|
||||
ipfs_gateway: str = "https://ipfs.io/ipfs",
|
||||
on_playlist_update: callable = None,
|
||||
audio_source: str = None,
|
||||
resume_from: Optional[Dict] = None,
|
||||
):
|
||||
"""Initialize multi-resolution HLS output.
|
||||
|
||||
Args:
|
||||
output_dir: Directory for HLS output files
|
||||
source_size: (width, height) of source frames
|
||||
fps: Frames per second
|
||||
segment_duration: Duration of each HLS segment in seconds
|
||||
ipfs_gateway: IPFS gateway URL for playlist URLs
|
||||
on_playlist_update: Callback when playlists are updated
|
||||
audio_source: Optional audio file to mux with video
|
||||
resume_from: Optional dict to resume from checkpoint with keys:
|
||||
- segment_cids: Dict of quality -> {seg_num: cid}
|
||||
"""
|
||||
self.output_dir = Path(output_dir)
|
||||
self.output_dir.mkdir(parents=True, exist_ok=True)
|
||||
self.source_width, self.source_height = source_size
|
||||
@@ -75,6 +89,13 @@ class MultiResolutionHLSOutput:
|
||||
self.qualities: Dict[str, QualityLevel] = {}
|
||||
self._setup_quality_levels()
|
||||
|
||||
# Restore segment CIDs if resuming (don't re-upload existing segments)
|
||||
if resume_from and resume_from.get('segment_cids'):
|
||||
for name, cids in resume_from['segment_cids'].items():
|
||||
if name in self.qualities:
|
||||
self.qualities[name].segment_cids = dict(cids)
|
||||
print(f"[MultiResHLS] Restored {len(cids)} segment CIDs for {name}", file=sys.stderr)
|
||||
|
||||
# IPFS client
|
||||
from ipfs_client import add_file, add_bytes
|
||||
self._ipfs_add_file = add_file
|
||||
|
||||
Reference in New Issue
Block a user