From 0f30c34463f5e0cff1b5778de544678b6ceafd22 Mon Sep 17 00:00:00 2001 From: Kiro Date: Thu, 14 May 2026 15:44:31 +0000 Subject: [PATCH] feat: ffprobe + TMDb scrape + HLS transcode + history/favourites/playlists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backend - service/ffprobe.go: thin ffprobe wrapper, parses duration / resolution / codecs into a typed ProbeResult. 30s per-file timeout. - service/tmdb.go: minimal TMDb provider (search/movie). Disabled when no api key; supports tmdb_api_proxy / tmdb_image_proxy overrides for users behind a firewall. - service/scraper.go: filename cleaner (handles bracketed tags, scene noise tokens, year extraction), per-row + per-library enrichment with a 4 RPS throttle and WS hub progress events. Unit-tested. - service/scanner.go: now invokes ffprobe per file and kicks the TMDb scraper in the background once a library scan finishes. - service/transcoder.go: per-media ffmpeg HLS job manager; outputs index.m3u8 + seg_NNNNN.ts under cache/hls/; cancels jobs on shutdown; publishes 'transcode' WS events. - service/stream.go: serves HLS playlist (with 30s wait-for-ready) and .ts segments with path-traversal protection. Adds Probe() helper used by the admin 'reprobe' button. - service/image_proxy.go: cached, host-allow-listed reverse proxy for TMDb / Bangumi / Douban / Fanart / TheTVDB images so the SPA never hits a CORS or GFW issue. - service/playback.go: history upsert, favourites toggle, playlist CRUD + ordered items. RecentHistory joins with model.Media in one extra query so the home page can render a 'Continue Watching' row. - handler/streaming.go + handler/playback.go: REST endpoints for HLS, image proxy, scrape (one + library), reprobe, history, favourites, playlists. - handler/handler.go: registers /api/hls/:id/{index.m3u8,:seg}, /api/img, /api/history, /api/favourites/:id, /api/playlists/* with proper auth/admin guards. Frontend - api/client.ts: imageURL() helper; hlsURL() endpoint; reuses the JWT in a query parameter for