Skip to content

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

fix: prevent playback resolution spam

Samir Hossains7e7f9ff73a38
diff --git a/src/tui/app.rs b/src/tui/app.rs
index 5324649..d11a398 100644
--- a/src/tui/app.rs
+++ b/src/tui/app.rs
@@ -3196,6 +3196,10 @@ impl App {
}
Action::PlayStream(open_with) => {
+ if self.state.is_resolving_playback {
+ return None;
+ }
+ self.state.is_resolving_playback = true;
if self.state.active_provider == ProviderKind::FourKHdHub {
if let Some(release) = self.get_selected_release() {
self.state.notify(
@@ -3274,9 +3278,12 @@ impl App {
self.action_sender.send(Action::LaunchMpv(link, None)).ok();
}
}
+ } else {
+ self.state.is_resolving_playback = false;
}
}
Action::ShowSubtitlePopup(link, ext_captions, open_with) => {
+ self.state.is_resolving_playback = false;
let mut options = vec![("None".to_string(), "".to_string())];
if let Some(captions_list) =
@@ -3319,6 +3326,7 @@ impl App {
}
}
Action::ShowDownloadSubtitlePopup(ext_captions) => {
+ self.state.is_resolving_playback = false;
let mut options = vec![("None".to_string(), "".to_string())];
if let Some(captions_list) =
@@ -3372,6 +3380,7 @@ impl App {
self.state.dirty = true;
}
Action::LaunchMpv(link, subtitle_url) => {
+ self.state.is_resolving_playback = false;
let player = self.state.available_players.first().cloned();
match player {
None => {
@@ -3400,6 +3409,10 @@ impl App {
}
}
Action::DownloadStream(subtitle_url) => {
+ if self.state.is_resolving_playback {
+ return None;
+ }
+ self.state.is_resolving_playback = true;
if self.state.active_provider == ProviderKind::FourKHdHub {
if let Some(release) = self.get_selected_release() {
self.state.notify(
@@ -3439,6 +3452,7 @@ impl App {
return None;
}
Action::StartDownload(subtitle_url, link) => {
+ self.state.is_resolving_playback = false;
self.start_resilient_download(subtitle_url, link);
return None;
}
@@ -3760,6 +3774,7 @@ impl App {
self.state.status_timer = 150;
}
Action::SetStatus(msg) => {
+ self.state.is_resolving_playback = false;
if msg.starts_with("Error:") {
self.state.notify(
NotificationKind::Error,
diff --git a/src/tui/state.rs b/src/tui/state.rs
index 11822b3..6dcc37f 100644
--- a/src/tui/state.rs
+++ b/src/tui/state.rs
@@ -122,6 +122,7 @@ pub struct AppState {
pub player_picker_playback: Option<crate::providers::models::PlaybackSource>,
pub available_players: Vec<PlayerKind>,
pub is_loading: bool,
+ pub is_resolving_playback: bool,
pub status_message: String,
pub status_timer: usize,
pub notifications: std::collections::VecDeque<crate::tui::overlay::Notification>,
@@ -228,6 +229,7 @@ impl Default for AppState {
available_players: Vec::new(),
dirty: true,
is_loading: false,
+ is_resolving_playback: false,
status_message: String::new(),
status_timer: 0,
notifications: std::collections::VecDeque::new(),