Add inline media previews for runs list and detail page

- Run card shows thumbnail previews for inputs and output
- Run detail shows output media inline (image/video/audio)
- Add audio detection (MP3, FLAC, OGG, WAV) to detect_media_type
- Add debug logging for recipe count on home page
- Add console.log debugging for DAG elements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 00:20:26 +00:00
parent 5c3558e1ba
commit 82d94f6e0e
5 changed files with 136 additions and 12 deletions

View File

@@ -50,7 +50,10 @@ def detect_media_type(cache_path: Path) -> str:
# Video signatures
if header[:4] == b'\x1a\x45\xdf\xa3': # WebM/MKV
return "video"
if len(header) > 8 and header[4:8] == b'ftyp': # MP4/MOV
if len(header) > 8 and header[4:8] == b'ftyp': # MP4/MOV/M4A
# Check for audio-only M4A
if len(header) > 11 and header[8:12] in (b'M4A ', b'm4a '):
return "audio"
return "video"
if header[:4] == b'RIFF' and len(header) > 12 and header[8:12] == b'AVI ': # AVI
return "video"
@@ -65,6 +68,16 @@ def detect_media_type(cache_path: Path) -> str:
if header[:4] == b'RIFF' and len(header) > 12 and header[8:12] == b'WEBP': # WebP
return "image"
# Audio signatures
if header[:3] == b'ID3' or header[:2] == b'\xff\xfb': # MP3
return "audio"
if header[:4] == b'fLaC': # FLAC
return "audio"
if header[:4] == b'OggS': # Ogg (could be audio or video, assume audio)
return "audio"
if header[:4] == b'RIFF' and len(header) > 12 and header[8:12] == b'WAVE': # WAV
return "audio"
return "unknown"