Skip to content

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

feat: update player selection UI, refine keybindings

Samir Hossains4af6e8670a7c
diff --git a/src/tui/app.rs b/src/tui/app.rs
index ca7f54f..29d9c11 100644
--- a/src/tui/app.rs
+++ b/src/tui/app.rs
@@ -401,6 +401,11 @@ impl App {
KeyCode::Char('y') | KeyCode::Char('c') => {
self.action_sender.send(Action::CopyLink).ok();
}
+ KeyCode::Char('o') | KeyCode::Char('O') => {
+ if let crate::tui::state::DetailsPane::Streams = self.state.details_pane {
+ self.action_sender.send(Action::PlayStream(true)).ok();
+ }
+ }
KeyCode::Char('d') | KeyCode::Char('D') => {
self.action_sender.send(Action::DownloadStream).ok();
}
@@ -432,7 +437,7 @@ impl App {
}
KeyCode::Enter => {
let open_with = key.modifiers.contains(crossterm::event::KeyModifiers::SHIFT);
- if self.state.subtitle_popup {
+ if self.state.subtitle_popup || self.state.player_picker_popup {
self.action_sender.send(Action::Submit).ok();
} else {
match self.state.details_pane {
@@ -1011,6 +1016,7 @@ impl App {
None => 0,
};
self.state.player_picker_state.select(Some(i));
+ return None;
} else if self.state.subtitle_popup {
let current = self.state.subtitle_list_state.selected().unwrap_or(0);
if current > 0 {
@@ -1115,6 +1121,7 @@ impl App {
None => 0,
};
self.state.player_picker_state.select(Some(i));
+ return None;
} else if self.state.subtitle_popup {
let current = self.state.subtitle_list_state.selected().unwrap_or(0);
if current + 1 < self.state.subtitle_list.len() {
@@ -1326,6 +1333,17 @@ impl App {
if self.state.last_search_edit.elapsed().as_millis() < 500 {
return None;
}
+ if self.state.player_picker_popup {
+ self.state.player_picker_popup = false;
+ let idx = self.state.player_picker_state.selected().unwrap_or(0);
+ if let Some(player) = self.state.available_players.get(idx).copied() {
+ if let Some(link) = self.state.player_picker_link.take() {
+ let sub = self.state.player_picker_subtitle.take();
+ self.action_sender.send(Action::LaunchPlayer(player, link, sub)).ok();
+ }
+ }
+ return None;
+ }
if self.state.subtitle_popup {
self.state.subtitle_popup = false;
let idx = self.state.subtitle_list_state.selected().unwrap_or(0);
@@ -2476,10 +2494,11 @@ impl App {
use ratatui::widgets::Paragraph;
+ let inner_area = area.inner(ratatui::layout::Margin { vertical: 1, horizontal: 2 });
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Length(1), Constraint::Min(0)])
- .split(area);
+ .split(inner_area);
let toast_area = Layout::default()
.direction(Direction::Horizontal)
diff --git a/src/tui/screens/details.rs b/src/tui/screens/details.rs
index 9408e10..b8c967a 100644
--- a/src/tui/screens/details.rs
+++ b/src/tui/screens/details.rs
@@ -603,7 +603,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
}
if state.player_picker_popup {
- let popup_width = 40;
+ let popup_width = 24;
let popup_height = std::cmp::min(15, state.available_players.len() as u16 + 2);
let area = frame.area();
@@ -621,9 +621,9 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
.iter()
.map(|k| {
let text = match k {
- crate::tui::state::PlayerKind::Mpv => "mpv (terminal)",
- crate::tui::state::PlayerKind::Iina => "IINA (macOS)",
- crate::tui::state::PlayerKind::Vlc => "VLC (cross-platform)",
+ crate::tui::state::PlayerKind::Mpv => "mpv",
+ crate::tui::state::PlayerKind::Iina => "IINA",
+ crate::tui::state::PlayerKind::Vlc => "VLC",
};
ratatui::widgets::ListItem::new(text)
})
@@ -645,7 +645,7 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
}
let footer_text =
- "Enter Play ⇧+Enter Open With... D Download C Copy Link Esc Back";
+ "Enter Play o Open With... D Download C Copy Link Esc Back";
let footer_p = Paragraph::new(footer_text)
.alignment(Alignment::Center)
.style(theme.muted);