[ci skip] f1-stream: add extractor framework with demo streams (Phase 3)
- BaseExtractor ABC with health_check method - ExtractorRegistry with concurrent fan-out extraction - ExtractionService with in-memory cache and background polling - DemoExtractor with 3 public HLS test streams - Adaptive polling: 5min during live sessions, 30min otherwise - GET /streams, GET /extractors, POST /extract endpoints
This commit is contained in:
parent
461e355a5d
commit
d15337e838
8 changed files with 608 additions and 5 deletions
29
stacks/f1-stream/files/backend/extractors/models.py
Normal file
29
stacks/f1-stream/files/backend/extractors/models.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""Data models for the stream extraction framework."""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExtractedStream:
|
||||
"""Represents a single stream URL discovered by an extractor."""
|
||||
|
||||
url: str # The HLS/m3u8 URL
|
||||
site_key: str # Which extractor found it
|
||||
site_name: str # Human-readable name
|
||||
quality: str = "" # e.g., "720p", "1080p", or empty
|
||||
title: str = "" # e.g., "F1 Race Live"
|
||||
extracted_at: str = field(default_factory=lambda: datetime.now(timezone.utc).isoformat())
|
||||
is_live: bool = False # Whether it passed health check
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
"""Serialize to a plain dictionary for JSON responses."""
|
||||
return {
|
||||
"url": self.url,
|
||||
"site_key": self.site_key,
|
||||
"site_name": self.site_name,
|
||||
"quality": self.quality,
|
||||
"title": self.title,
|
||||
"extracted_at": self.extracted_at,
|
||||
"is_live": self.is_live,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue