Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
fix(tui): map player exit codes to actionable playback notifications
Samir Hossainsc137544a84b4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d35a874..e06c1f5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,8 @@- **Details Screen Modal Backdrop Dimming**:- Dimmed empty stream placeholder and status messages (e.g. *"Choose an audio track to load streams."*) to `theme.muted` when any modal or synopsis overlay is open, matching the dimmed backdrop styling of the rest of the details screen.+- **Concise Actionable Playback Error Notifications**:+ - Mapped player exit codes to short, direct notices in `src/tui/app/playback.rs` (`Stream Dead: Link expired or unreachable.` for code 2, `Player Error: Check player configuration.` for code 1), replacing cryptic raw process exit strings (`Player exited (code 2).`).## [0.1.22] - 2026-09-21### Added- **Dramachi Native Streaming Provider**:diff --git a/docs/players.md b/docs/players.mdindex d2fa20a..0a1d7ab 100644--- a/docs/players.md+++ b/docs/players.md@@ -64,7 +64,8 @@ process group (Unix `process_group(0)`) or no-console flag (Windows `CREATE_NO_W- **Clean Exit Normalization**: Routine exit states are normalized to avoid false crash reports:- VLC exit code `1` with empty stderr (normal stream completion under `--play-and-exit`) is classified as clean exit (`PlayerExited`).- Unix `SIGTERM` (signal 15) termination when the user closes player windows via the OS is treated as clean exit.- - Genuine non-zero failures with stderr diagnostics are surfaced as actionable player errors. Watch progress is reconciled only after a successful exit.+ - Genuine non-zero failures with stderr diagnostics are surfaced directly as actionable player errors.+ - When players exit without stderr diagnostics, exit codes are translated into actionable notifications (e.g. exit code `2` indicates `Stream Dead: Link expired or unreachable.`, exit code `1` indicates `Player Error: Check player configuration.`). Watch progress is reconciled only after a successful exit.## Android / Termux Playback Architecturediff --git a/src/tui/app/playback.rs b/src/tui/app/playback.rsindex 62dbb84..1dc47ba 100644--- a/src/tui/app/playback.rs+++ b/src/tui/app/playback.rs@@ -1054,12 +1054,40 @@ impl App {"Run 'pkg install termux-tools'.".to_string(),)} else {- let formatted_msg = if let Some(c) = code {- format!("Player exited (code {c}).")- } else {- "Player exited.".to_string()- };- ("Playback Failed", formatted_msg)+ match code {+ Some(2) => (+ "Stream Dead",+ if !error_msg.is_empty() && !error_msg.starts_with("Player exited") {+ error_msg+ } else {+ "Link expired or unreachable.".to_string()+ },+ ),+ Some(1) => (+ "Player Error",+ if error_msg.is_empty() || error_msg.starts_with("Player exited") {+ "Check player configuration.".to_string()+ } else {+ error_msg+ },+ ),+ Some(c) => (+ "Playback Failed",+ if !error_msg.is_empty() && !error_msg.starts_with("Player exited") {+ error_msg+ } else {+ format!("Player exited ({c}).")+ },+ ),+ None => (+ "Playback Failed",+ if !error_msg.is_empty() && !error_msg.starts_with("Player exited") {+ error_msg+ } else {+ "Player terminated.".to_string()+ },+ ),+ }};self.state.set_status(format!("{title}: {message}"), 300);@@ -1099,6 +1127,17 @@ mod tests {"Player exited unsuccessfully without error output.");}+ #[test]+ fn player_exit_code_interpretation() {+ let code = Some(2);+ let msg = match code {+ Some(2) => ("Stream Dead", "Link expired or unreachable."),+ Some(1) => ("Player Error", "Check player configuration."),+ _ => ("Playback Failed", "Player exited."),+ };+ assert_eq!(msg.0, "Stream Dead");+ assert_eq!(msg.1, "Link expired or unreachable.");+ }#[test]fn vlc_exit_code_1_empty_stderr_is_normal_exit() {