Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
docs: update download naming standards, subtitle language tags, and duplication prevention
Samir Hossainsdf918da9f594
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 95de5a3..c67ae43 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,7 +14,9 @@- Pressing `d` or clicking `[Download]` while on the **Seasons** pane prompts to download the whole season (all episodes).- Triggering download while on **Episodes** or **Streams** downloads that single episode.- **Organized Downloads & Custom Directory**:- - Structured Series downloads under `<base_dir>/Series/<Title>/Season <N>/<Title>_S<N:02>E<E:02>.<ext>` and Movies under `<base_dir>/Movies/<Title>/<Title>.<ext>`.+ - Structured Series downloads under `<base_dir>/Series/<Title>/Season <N>/<Title> - S<N:02>E<E:02>.<ext>` (Plex/Jellyfin standard) and Movies under `<base_dir>/Movies/<Title>/<Title>.<ext>`.+ - Added ISO 639-1 language code tagging to subtitle sidecars (e.g. `<BaseName>.en.srt`) for automatic track identification in media players and servers.+ - Added smart duplication prevention: completed episodes on disk are automatically skipped during season batch downloads.- Added `/download-dir <path>` slash command with directory creation and active write-probe validation.- Added `/download-dir reset` (contextually suggested only when custom path is configured) to revert to OS default.- Safe automatic fallback to default OS Downloads folder if custom path becomes inaccessible.@@ -34,6 +36,8 @@- Curated `/browse` views into 4 categorized shelves (Popular, Top Rated, Trending, Most Watched) with proper filtering.### Fixed+- **Stream Pool Initialization on Audio Selection**: Fixed stream fetching hanging on "Loading streams..." when selecting non-default audio dubs by ensuring stream pool entries are initialized before episode fetch.+- **Title Sanitization & Preservation**: Enhanced `clean_moviebox_title` to sanitize international audio dubs, video quality tags, and format markers across downloads, folder organization, and watch history while preserving 4-digit release years.- **Terminal Restoration & Signal Handling**: Added `Ctrl+C` keyboard handling and asynchronous `SIGINT` signal listener to guarantee raw mode and alternate screen are always cleanly restored.- **Download Hierarchy & Numbering**: Fixed series media type detection and removed season/episode off-by-one addition.- **Parser UTF-8 Safety**: Hardened language detection boundary checks for multibyte titles against panics.diff --git a/README.md b/README.mdindex d76d949..a512c63 100644--- a/README.md+++ b/README.md@@ -243,18 +243,18 @@ MovieBox-TUI/├── Movies/│ └── <title>/│ ├── <title>.<ext>-│ └── <title>.<sub_ext>+│ └── <title>.<lang>.<sub_ext>└── Series/└── <title>/└── Season <number>/- ├── <title>_S01E01.<ext>- └── <title>_S01E01.<sub_ext>+ ├── <title> - S01E01.<ext>+ └── <title> - S01E01.<lang>.<sub_ext>```- **Custom download directory:** Use `/download-dir <path>` (e.g. `/download-dir ~/Videos` or `/download-dir /Volumes/Drive`) to change and persist your download folder. Use `/download-dir reset` to return to default.- **Contextual triggers:** Pressing `d` or clicking `[Download]` while focused on the **Seasons** pane prompts to download the whole season; while on **Episodes** or **Streams**, it downloads that single episode.-- **Sequential downloads:** Entire seasons are downloaded one by one to limit disk and network pressure.-- **Smart subtitles:** Your subtitle language choice for the first episode is applied to the remaining episodes. Missing subtitles do not discard completed video files.+- **Sequential downloads & Duplication prevention:** Entire seasons are downloaded one by one. Existing completed episodes are automatically skipped to save bandwidth and prevent duplicate files.+- **Smart subtitle tagging:** Subtitles are saved with ISO 639-1 language codes (e.g. `.en.srt`, `.hi.srt`) so media players (VLC, mpv, IINA) and media servers (Plex, Jellyfin, Kodi) automatically identify track languages. Missing subtitles do not discard completed video files.- **Robust resuming:** Interrupted downloads preserve `.part` and metadata files, and can be resumed without losing progress.- On Android/Termux, the app prefers shared `storage/downloads` when it exists.diff --git a/docs/downloads.md b/docs/downloads.mdindex 23a1a76..edfc4da 100644--- a/docs/downloads.md+++ b/docs/downloads.md@@ -22,21 +22,18 @@ and optional segmentation. Orchestration lives in `app/download.rs`.characters are replaced, Windows reserved names (`CON`, `COM1`-`COM9`, …) are avoided,and length is capped.-- **Series downloads:** Saved under `<base_dir>/Series/<Title>/Season <N>/<Title>_S<N:02>E<E:02>.<ext>` (and subtitle `<Title>_S<N:02>E<E:02>.<sub_ext>`).-- **Movie downloads:** Saved under `<base_dir>/Movies/<Title>/<Title>.<ext>` (and subtitle `<Title>.<sub_ext>`).+- **Series downloads:** Saved under `<base_dir>/Series/<Title>/Season <N>/<Title> - S<N:02>E<E:02>.<ext>` (and subtitle `<Title> - S<N:02>E<E:02>.<lang>.<sub_ext>`).+- **Movie downloads:** Saved under `<base_dir>/Movies/<Title>/<Title>.<ext>` (and subtitle `<Title>.<lang>.<sub_ext>`).- **Default path:** Files go to the user's OS download directory (`~/Downloads/MovieBox-TUI`). On Android-family environments the code prefers shared `storage/downloads` when present.- **Custom path:** Users can set a custom download directory using `/download-dir <path>` or revert with `/download-dir reset`. Target directories are validated with active write probes before saving, and the engine automatically falls back to default if custom storage becomes unavailable at runtime.## Contextual triggers & Seasons- **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.-- 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.+- **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 automatically skipped to avoid duplicate downloads and bandwidth consumption.+- 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.-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.+Selected subtitle sidecars are saved next to the video using standard ISO 639-1 language codes (e.g. `.en.srt`, `.hi.srt`) and supported subtitle extensions (`.srt`, `.vtt`, `.ass`, `.ssa`, `.sub`) so media players and media servers identify the track language automatically.## Outcomes