Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

feat: expand Android platform detection and add validation for IINA CLI on macOS

Samir Hossains4d3ccc7a72f7
diff --git a/src/tui/player.rs b/src/tui/player.rs
index 2a276e1..f051240 100644
--- a/src/tui/player.rs
+++ b/src/tui/player.rs
@@ -23,7 +23,10 @@ pub fn detect() -> Vec<PlayerKind> {
players.push(PlayerKind::Vlc);
}
- let is_android = cfg!(target_os = "android") || std::path::Path::new("/system/bin/am").exists();
+ let is_android = cfg!(target_os = "android")
+ || std::path::Path::new("/system/bin/am").exists()
+ || executable_on_path("termux-open")
+ || executable_on_path("am");
if is_android {
players.push(PlayerKind::AndroidIntent);
@@ -36,6 +39,10 @@ pub fn supports_headers(kind: PlayerKind, headers: &[(String, String)]) -> bool
if kind == PlayerKind::AndroidIntent {
return false;
}
+ #[cfg(target_os = "macos")]
+ if kind == PlayerKind::Iina && !iina_cli_exists() {
+ return false;
+ }
kind != PlayerKind::Vlc
|| headers.iter().all(|(name, _)| {
name.eq_ignore_ascii_case("referer") || name.eq_ignore_ascii_case("user-agent")
@@ -345,6 +352,18 @@ fn iina_app_exists() -> bool {
|| dirs::home_dir().is_some_and(|home| home.join("Applications/IINA.app").exists())
}
+#[cfg(target_os = "macos")]
+fn iina_cli_exists() -> bool {
+ let cli_global = Path::new("/Applications/IINA.app/Contents/MacOS/iina-cli");
+ let cli_local = dirs::home_dir()
+ .map(|h| h.join("Applications/IINA.app/Contents/MacOS/iina-cli"))
+ .unwrap_or_default();
+ configured_executable("MOVIEBOX_IINA_PATH").is_some()
+ || cli_global.exists()
+ || cli_local.exists()
+ || command_exists("iina")
+}
+
fn flatpak_executable(app_id: &str) -> Option<String> {
if !cfg!(target_os = "linux") {
return None;