Skip to content

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

fix(download): preserve subtitle extension

Samir Hossains7c7f65dcbcef
diff --git a/docs/downloads.md b/docs/downloads.md
index dd32f54..086b6d1 100644
--- a/docs/downloads.md
+++ b/docs/downloads.md
@@ -29,6 +29,10 @@ A season download enqueues every episode (`download_queue`) and processes them o
time, each resolving its stream and subtitle. Progress is reported through
`Action::UpdateDownload` and the status bar; failures pause and preserve partial data.
+Selected subtitle sidecars are saved next to the video using the subtitle URL's
+supported extension (`.srt`, `.vtt`, `.ass`, `.ssa`, `.sub`) so external players see
+the correct format.
+
## Outcomes
`DownloadCompleted` / `DownloadPaused` / `DownloadFailed` drive the UI status and
diff --git a/src/tui/app/download.rs b/src/tui/app/download.rs
index 020d5f2..d9c1fa0 100644
--- a/src/tui/app/download.rs
+++ b/src/tui/app/download.rs
@@ -136,7 +136,15 @@ impl App {
}
if let Some(subtitle_url) = subtitle_url {
- let subtitle_path = destination.with_extension("srt");
+ let subtitle_extension = subtitle_url
+ .rsplit('.')
+ .next()
+ .map(|extension| extension.to_ascii_lowercase())
+ .filter(|extension| {
+ matches!(extension.as_str(), "srt" | "vtt" | "ass" | "ssa" | "sub")
+ })
+ .unwrap_or_else(|| "srt".to_string());
+ let subtitle_path = destination.with_extension(subtitle_extension);
let result = tokio::time::timeout(
std::time::Duration::from_secs(30),
client.get(subtitle_url).send(),