Skip to content

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

feat(terminal): add MOVIEBOX_NO_IMAGE and MOVIEBOX_HALFBLOCKS overrides and clean cache fallbacks

Samir Hossainse6c9c9095d18
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 57dc691..92dd65c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,8 @@
- Unified image caching under a shared namespace with automatic cross-namespace lookup across MovieBox, 4KHDHub, IPTV, CircleFTP, and DhakaFlix.
- **Streamlined Browse Views**:
- Curated `/browse` views into 4 categorized shelves (Popular, Top Rated, Trending, Most Watched) with proper filtering.
+- **Terminal Graphics Fallback Overrides**:
+ - Added `MOVIEBOX_NO_IMAGE=1` and `MOVIEBOX_HALFBLOCKS=1` environment overrides to disable terminal image querying or force Unicode halfblock graphics for SSH, tmux, and slow remote connections.
### Fixed
- **Default Audio Track Prioritization (Original / English)**:
diff --git a/docs/config.md b/docs/config.md
index d2f6c62..b5123eb 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -32,6 +32,8 @@ macOS `~/Library/Application Support/moviebox-tui`, Linux `~/.config/moviebox-tu
| `MOVIEBOX_IINA_PATH` | Custom IINA/iina-cli executable. |
| `MOVIEBOX_FOURKHDHUB_URL` | Override the 4KHDHub base URL. |
| `MOVIEBOX_THEME` | Force a theme (e.g. `Mocha`, `Latte`). |
+| `MOVIEBOX_NO_IMAGE` | Disable poster image queries (set to `1` or `true`). |
+| `MOVIEBOX_HALFBLOCKS` | Force halfblock Unicode character graphics for posters (set to `1` or `true`). |
## CLI
diff --git a/docs/cross-platform.md b/docs/cross-platform.md
index 80a3a5d..e2ac072 100644
--- a/docs/cross-platform.md
+++ b/docs/cross-platform.md
@@ -18,7 +18,7 @@ The app probes the terminal at startup via `ratatui_image`:
- **Poster rendering**: Sixel / Kitty / iTerm2 / HalfBlocks per terminal support; the
image protocol is re-queried on resize and scroll, and focus changes use a soft
- refresh so launching a player does not flash the screen.
+ refresh so launching a player does not flash the screen. Users can explicitly disable image querying via `MOVIEBOX_NO_IMAGE=1` or force Unicode halfblock rendering via `MOVIEBOX_HALFBLOCKS=1`.
- **Terminal classification**: `TERM=dumb`/`linux` fall back to a basic UI.
- Focus events (focus loss/gain) are used to re-render in place without clearing.
diff --git a/src/main.rs b/src/main.rs
index 840772c..557fdfb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -64,12 +64,15 @@ async fn main() -> std::io::Result<()> {
println!(" -h, --help Print help information");
println!(" -v, -V, --version Print version information\n");
println!("ENVIRONMENT VARIABLES:");
- println!(" MOVIEBOX_LOG Log level (info, warn, error, debug, trace)");
- println!(" MOVIEBOX_THEME Theme name (e.g. catppuccin, dracula, nord, etc.)");
- println!(" MOVIEBOX_PLAYER Preferred player (mpv, iina, vlc, android)");
- println!(" MOVIEBOX_MPV_PATH Custom mpv binary path");
- println!(" MOVIEBOX_VLC_PATH Custom vlc binary path");
- println!(" MOVIEBOX_IINA_PATH Custom iina-cli binary path");
+ println!(" MOVIEBOX_LOG Log level (info, warn, error, debug, trace)");
+ println!(" MOVIEBOX_THEME Theme name (e.g. catppuccin, dracula, nord, etc.)");
+ println!(" MOVIEBOX_PLAYER Preferred player (mpv, iina, vlc, android)");
+ println!(" MOVIEBOX_MPV_PATH Custom mpv binary path");
+ println!(" MOVIEBOX_VLC_PATH Custom vlc binary path");
+ println!(" MOVIEBOX_IINA_PATH Custom iina-cli binary path");
+ println!(" MOVIEBOX_FOURKHDHUB_URL Custom 4KHDHub base URL");
+ println!(" MOVIEBOX_NO_IMAGE Disable poster image queries (1/true)");
+ println!(" MOVIEBOX_HALFBLOCKS Force halfblock terminal graphics (1/true)");
return Ok(());
}
if args
diff --git a/src/providers/m3u.rs b/src/providers/m3u.rs
index e309aeb..f576fbb 100644
--- a/src/providers/m3u.rs
+++ b/src/providers/m3u.rs
@@ -24,7 +24,7 @@ impl Default for M3UParser {
impl M3UParser {
pub fn new() -> Self {
- let mut cache_dir = dirs::cache_dir().unwrap_or_else(|| PathBuf::from("."));
+ let mut cache_dir = dirs::cache_dir().unwrap_or_else(std::env::temp_dir);
cache_dir.push("moviebox-tui");
cache_dir.push("tv_playlists");
std::fs::create_dir_all(&cache_dir).ok();
diff --git a/src/tui/app/run.rs b/src/tui/app/run.rs
index 026f874..fe1aa63 100644
--- a/src/tui/app/run.rs
+++ b/src/tui/app/run.rs
@@ -14,8 +14,14 @@ impl App {
{
if self.state.image_picker.is_none() && self.state.image_supported {
let picker = if crate::tui::terminal::should_query_images() {
- ratatui_image::picker::Picker::from_query_stdio()
- .unwrap_or_else(|_| ratatui_image::picker::Picker::halfblocks())
+ if std::env::var("MOVIEBOX_HALFBLOCKS")
+ .is_ok_and(|v| v == "1" || v.eq_ignore_ascii_case("true"))
+ {
+ ratatui_image::picker::Picker::halfblocks()
+ } else {
+ ratatui_image::picker::Picker::from_query_stdio()
+ .unwrap_or_else(|_| ratatui_image::picker::Picker::halfblocks())
+ }
} else {
ratatui_image::picker::Picker::halfblocks()
};
diff --git a/src/tui/terminal.rs b/src/tui/terminal.rs
index ebd5d42..a69c636 100644
--- a/src/tui/terminal.rs
+++ b/src/tui/terminal.rs
@@ -9,6 +9,10 @@ pub fn uses_basic_ui() -> bool {
}
pub fn should_query_images() -> bool {
+ if std::env::var("MOVIEBOX_NO_IMAGE").is_ok_and(|v| v == "1" || v.eq_ignore_ascii_case("true"))
+ {
+ return false;
+ }
let term = env("TERM");
term != "dumb" && term != "linux"