"""Ground-truth media probe for a produced library file — the SINGLE place both ingest paths ask "what is actually on disk?". `media_kind` (and the stored `vcodec`/`acodec`/`width`/`height`) must reflect the real file, not an extractor's metadata: yt-dlp's `info` dict omits codec fields for some sources (e.g. Facebook), and deriving the kind from those nulls misclassified a genuine H.264 video as a download-only `file` (no in-app play). So the download worker (`pipeline`) and the local upload ingest (`upload`) both probe the finished file here; `mediakind.derive` then turns the probed codecs into the kind. """ from pathlib import Path from app.downloads import edit as editmod # ffprobe container formats that mean "this is a still image / image sequence", NOT playable media. # A standalone jpg/png/gif/webp/bmp reports a real video stream (codec mjpeg/png/…) with no # `attached_pic` flag, so without this guard it would classify as media_kind='video' and get a Play # button + a broken in-app