Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
fix(player): unify iina command arguments and scope header fallback check
Samir Hossains8d3d250fbdeb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f47bd0d..309e7dd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,7 @@- Mounted `xdg-cache/moviebox-tui:ro`, `xdg-data/moviebox-tui`, and `/tmp:ro` in `flatpak run` while keeping custom user Flatpak flags so sandboxed `mpv` and `VLC` can read subtitles and write watch progress.- Served Termux private-storage subtitles over the local `StreamRelay` `/sub/` loopback endpoint when Android shared storage is unavailable, and restricted startup subtitle cleanup to internal cache and temp folders.- Parsed player `stderr` and exit codes to report specific failure reasons (`HTTP 403`, `HTTP 404`, `HTTP 410`, timeout, connection refused), and added deterministic cross-platform contract integration tests (`tests/player_contract.rs`) asserting VLC Win32/UNC paths, IINA CLI option schemas, and header support across OSes.+ - Unified IINA command construction with standard `--mpv-*` argument schemas across platforms, and restricted macOS IINA header disqualification to GUI app fallbacks missing command line tools.- **StreamRelay Proxy & Downloader**:- Forwarded `User-Agent` and `Referer` while isolating stream cookies (`Cookie: Edge-Cache-Cookie=...`) to same-host requests across `StreamRelay`, subtitle pre-downloads, and media downloads.- Capped `.m4s` segment chunk fetching in `StreamRelay` to batches of 16 concurrent `Range` requests, registered in-flight segment wait futures under lock, and required `http://` or `https://` schemes on `/proxy?url=` routes.diff --git a/src/player.rs b/src/player.rsindex db30f88..c35bee7 100644--- a/src/player.rs+++ b/src/player.rs@@ -92,7 +92,7 @@ pub fn supports_headers(kind: PlayerKind, headers: &[(String, String)]) -> boolreturn true;}#[cfg(target_os = "macos")]- if kind == PlayerKind::Iina && !matches!(iina_resolution(), Some(IinaResolution::Cli(_))) {+ if kind == PlayerKind::Iina && matches!(iina_resolution(), Some(IinaResolution::AppFallback)) {return false;}match kind {@@ -177,7 +177,6 @@ pub fn command(tracker,max_height,),- #[cfg(target_os = "macos")]PlayerKind::Iina => iina_command(url,subtitle,@@ -187,17 +186,6 @@ pub fn command(tracker,max_height,),- #[cfg(not(target_os = "macos"))]- PlayerKind::Iina => mpv_command(- url,- subtitle,- headers,- false,- window,- resume_seconds,- tracker,- max_height,- ),PlayerKind::Vlc => vlc_command(url, subtitle, headers, window, resume_seconds, max_height),PlayerKind::AndroidIntent => android_intent_command(url, subtitle, headers),}@@ -650,7 +638,6 @@ fn iina_resolution() -> Option<IinaResolution> {detected}-#[cfg(target_os = "macos")]#[allow(clippy::too_many_arguments)]fn iina_command(url: &str,@@ -661,8 +648,8 @@ fn iina_command(tracker: Option<(&str, &str, usize, usize)>,max_height: Option<u64>,) -> Command {- let resolution = iina_resolution();- let mut command = match resolution {+ #[cfg(target_os = "macos")]+ let mut command = match iina_resolution() {Some(IinaResolution::Cli(executable)) => {let mut c = Command::new(executable);c.arg("--keep-running").arg("--no-stdin");@@ -675,6 +662,8 @@ fn iina_command(}None => Command::new("iina"),};+ #[cfg(not(target_os = "macos"))]+ let mut command = Command::new("iina");let mpv = mpv_command(url,subtitle,