Skip to content

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

fix: remember season subtitle preference

Samir Hossains42c908be08f6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a1f1a18..53c495b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@
### Fixed
- **External player failure reporting**: Treat every non-zero player exit, including exits after several seconds or without stderr output, as a playback error instead of reconciling false watch progress.
- **Search focus**: Restore Backspace on the Home screen as a reliable way to focus the search input from results or Favorites.
+- **Season subtitles**: Remember an explicit subtitle or no-subtitle choice for every episode in a season download.
- **Playback state safety**: Sanitize provider and subject identifiers before using them in tracker state filenames.
- **Cross-platform release validation**: Run all-feature locked builds/tests, binary startup smoke tests, Unix and Windows installer syntax checks, and release-target builds in CI.
- **Documentation accuracy**: Document Android intent limitations, the actual Termux binary model, macOS-only IINA support, native runtime verification requirements, and the current automated test count.
diff --git a/docs/downloads.md b/docs/downloads.md
index ce63416..6475494 100644
--- a/docs/downloads.md
+++ b/docs/downloads.md
@@ -32,6 +32,7 @@ and length is capped.
- **Contextual trigger**: Pressing `d` (or clicking `[Download]`) while focused on the **Seasons** pane prompts to download all episodes of the selected season. Triggering download while on the **Episodes** or **Streams** pane prompts to download only that single episode.
- **Duplication prevention**: When starting a download or processing a season batch queue, the engine checks if the target media file is already completed on disk. Existing completed episodes are skipped.
- A season download enqueues every episode (`download_queue`) and processes them one at a time, each resolving its stream and subtitle. Progress is reported through `Action::UpdateDownload` and the status bar; failures pause and preserve partial data.
+- Season downloads ask for the subtitle policy once per batch. The selected language, including an explicit `None` choice, is reused for every queued episode.
Selected subtitle sidecars are saved next to the video using ISO 639-1 language codes (e.g. `.en.srt`, `.hi.srt`) and supported subtitle extensions (`.srt`, `.vtt`, `.ass`, `.ssa`, `.sub`).
diff --git a/docs/known-issues.md b/docs/known-issues.md
index 226abc2..6c78461 100644
--- a/docs/known-issues.md
+++ b/docs/known-issues.md
@@ -26,6 +26,6 @@ Tracked here so future work and issue reports reference the same facts.
## Verification
-- Automated testing is enforced via `cargo test --all-features --locked` covering 169 unit and integration tests across 16 test suites (see [`docs/testing.md`](testing.md)). The count is updated when tests change; it does not replace real-player and real-device verification.
+- Automated testing is enforced via `cargo test --all-features --locked` covering 171 unit and integration tests across 16 test suites (see [`docs/testing.md`](testing.md)). The count is updated when tests change; it does not replace real-player and real-device verification.
- Static correctness is enforced by strict compiler type checking, the lint gate (`cargo clippy --all-targets --all-features --locked -- -D warnings`), formatting (`cargo fmt --check`), dependency vulnerability scanning (`cargo audit`), and packaging verification (`cargo package --locked`).
- Runtime and platform-specific behavior (terminal resize, focus handling, external player launch, and Termux chooser) are verified through the release checklist in [`release-checklist.md`](release-checklist.md).
diff --git a/src/tui/app/download.rs b/src/tui/app/download.rs
index 0022dd8..22ebce4 100644
--- a/src/tui/app/download.rs
+++ b/src/tui/app/download.rs
@@ -108,7 +108,7 @@ impl App {
.state
.last_download_subtitle_language
.take()
- .or_else(|| self.state.season_subtitle_preference.clone());
+ .or_else(|| self.state.season_subtitle_preference.clone().flatten());
self.state.is_waiting_for_download_stream = false;
self.state.download_status = Some("Preparing download...".into());
diff --git a/src/tui/app/navigation.rs b/src/tui/app/navigation.rs
index 73b119a..4bb3ede 100644
--- a/src/tui/app/navigation.rs
+++ b/src/tui/app/navigation.rs
@@ -785,11 +785,10 @@ impl App {
let sub_url = self.state.subtitle_list.get(idx).map(|(_, u)| u.clone());
let sub_url_final = sub_url.filter(|s| !s.is_empty());
- if let Some(name) = sub_name.filter(|n| n != "None") {
- self.state.last_download_subtitle_language = Some(name.clone());
- if self.state.download_queue_total > 0 {
- self.state.season_subtitle_preference = Some(name);
- }
+ let selected_language = sub_name.filter(|n| n != "None");
+ self.state.last_download_subtitle_language = selected_language.clone();
+ if self.state.download_queue_total > 0 {
+ self.state.season_subtitle_preference = Some(selected_language);
}
self.action_sender
diff --git a/src/tui/app/requests.rs b/src/tui/app/requests.rs
index 4052b81..d953443 100644
--- a/src/tui/app/requests.rs
+++ b/src/tui/app/requests.rs
@@ -1990,16 +1990,17 @@ impl App {
let service = self.service.clone();
let sender = self.action_sender.clone();
let pref = self.state.season_subtitle_preference.clone();
- let no_pref = pref.is_none();
tokio::spawn(async move {
if let Ok(res) = service.get_ext_captions(&subject_id, &rid).await {
- if no_pref {
+ if pref.is_none() {
sender.send(Action::ShowDownloadSubtitlePopup(res)).ok();
- } else if let Some(pref_lang) = pref {
+ } else if let Some(pref_lang) = pref.flatten() {
let sub_url =
crate::tui::state::caption_url_for(&res, &pref_lang);
sender.send(Action::DownloadStream(sub_url)).ok();
+ } else {
+ sender.send(Action::DownloadStream(None)).ok();
}
} else {
sender.send(Action::DownloadStream(None)).ok();
diff --git a/src/tui/state.rs b/src/tui/state.rs
index 3dcfd4e..26d6308 100644
--- a/src/tui/state.rs
+++ b/src/tui/state.rs
@@ -153,7 +153,10 @@ pub struct AppState {
pub subtitle_popup: bool,
pub is_download_subtitle_popup: bool,
- pub season_subtitle_preference: Option<String>,
+ /// None means the season has not chosen a subtitle policy; Some(None)
+ /// records an explicit no-subtitles choice, and Some(Some(language))
+ /// records the selected language.
+ pub season_subtitle_preference: Option<Option<String>>,
pub last_download_subtitle_language: Option<String>,
pub subtitle_list: Vec<(String, String)>,
pub subtitle_list_state: ListState,
diff --git a/tests/tui_acceptance.rs b/tests/tui_acceptance.rs
index efb7cfb..5fb7658 100644
--- a/tests/tui_acceptance.rs
+++ b/tests/tui_acceptance.rs
@@ -24,6 +24,21 @@ async fn test_backspace_from_home_focuses_search_input() {
assert_eq!(app.state().search_query, "Inception");
}
+#[tokio::test]
+async fn test_season_download_remembers_explicit_no_subtitle_choice() {
+ let mut app = App::new();
+ app.state_mut().is_download_subtitle_popup = true;
+ app.state_mut().subtitle_list = vec![("None".to_string(), String::new())];
+ app.state_mut().subtitle_list_state.select(Some(0));
+ app.state_mut().download_queue_total = 4;
+ app.state_mut().last_search_edit =
+ std::time::Instant::now() - std::time::Duration::from_secs(1);
+
+ app.handle_action(Action::Submit).await;
+
+ assert_eq!(app.state().season_subtitle_preference, Some(None));
+}
+
#[tokio::test]
async fn test_tui_startup_and_home_screen_rendering() {
let backend = TestBackend::new(100, 30);