This commit is contained in:
krolxon 2024-05-12 20:37:32 +05:30
parent 8c4d19f849
commit 98cfe4eb26
1 changed files with 19 additions and 11 deletions

View File

@ -58,18 +58,24 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
// Fast forward // Fast forward
KeyCode::Char('f') => { KeyCode::Char('f') => {
let place = app.conn.conn.status().unwrap().song.unwrap().pos; if !app.queue_list.list.is_empty() {
let (pos, _) = app.conn.conn.status().unwrap().time.unwrap(); let status = app.conn.conn.status().unwrap_or_default();
let pos = Duration::from_secs(pos.as_secs().wrapping_add(2)); let place = status.song.unwrap_or_default().pos;
app.conn.conn.seek(place, pos)?; let (pos, _) = status.time.unwrap_or_default();
let pos = Duration::from_secs(pos.as_secs().wrapping_add(2));
app.conn.conn.seek(place, pos)?;
}
} }
// backward // backward
KeyCode::Char('b') => { KeyCode::Char('b') => {
let place = app.conn.conn.status().unwrap().song.unwrap().pos; if !app.queue_list.list.is_empty() {
let (pos, _) = app.conn.conn.status().unwrap().time.unwrap(); let status = app.conn.conn.status().unwrap_or_default();
let pos = Duration::from_secs(pos.as_secs().wrapping_add(2)); let place = status.song.unwrap_or_default().pos;
app.conn.conn.seek(place, pos)?; let (pos, _) = status.time.unwrap_or_default();
let pos = Duration::from_secs(pos.as_secs().wrapping_sub(2));
app.conn.conn.seek(place, pos)?;
}
} }
// Cycle through tabs // Cycle through tabs
@ -267,9 +273,11 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
// add to current playlist // add to current playlist
KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right | KeyCode::Char(' ') => { KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right | KeyCode::Char(' ') => {
// app.update_queue(); // app.update_queue();
app.conn if !app.pl_list.list.is_empty() {
.load_playlist(app.pl_list.list.get(app.pl_list.index).unwrap())?; app.conn
app.conn.update_status(); .load_playlist(app.pl_list.list.get(app.pl_list.index).unwrap())?;
app.conn.update_status();
}
} }
_ => {} _ => {}
} }