aboutsummaryrefslogtreecommitdiff
path: root/src/handler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/handler.rs')
-rwxr-xr-xsrc/handler.rs44
1 files changed, 38 insertions, 6 deletions
diff --git a/src/handler.rs b/src/handler.rs
index 32b4b6f..91b5f86 100755
--- a/src/handler.rs
+++ b/src/handler.rs
@@ -11,17 +11,17 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
}
KeyCode::Char('j') => {
- app.list.next();
+ app.song_list.next();
}
KeyCode::Char('k') => {
- app.list.prev();
+ app.song_list.prev();
}
KeyCode::Enter | KeyCode::Char('l') => {
- let song = app.conn.get_song_with_only_filename(app.conn.songs_filenames.get(app.list.index).unwrap());
- app.conn.push(&song).unwrap();
- app.update_queue();
+ let song = app.conn.get_song_with_only_filename(app.conn.songs_filenames.get(app.song_list.index).unwrap());
+ app.conn.push(&song)?;
+ // app.update_queue();
}
// Playback controls
@@ -35,10 +35,42 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
app.conn.pause();
}
+
// Clearn Queue
KeyCode::Char('x') => {
app.conn.conn.clear()?;
- app.update_queue();
+ // app.update_queue();
+ }
+
+ KeyCode::Char('d') => {
+ app.conn.play_dmenu()?;
+ }
+
+ KeyCode::Down=> {
+ app.pl_list.next();
+ }
+
+ KeyCode::Up=> {
+ app.pl_list.prev();
+ }
+
+
+ KeyCode::Right => {
+ app.conn.push_playlist(app.pl_list.list.get(app.pl_list.index).unwrap())?;
+ }
+
+ KeyCode::Char('f')=> {
+ // let place = app.conn.conn.status().unwrap().duration;
+ let (pos, _) = app.conn.conn.status().unwrap().time.unwrap();
+ let pos: i64 = (pos.as_secs() + 2).try_into().unwrap();
+ app.conn.conn.seek(2, pos )?;
+ }
+
+ KeyCode::Char('b')=> {
+ // let place = app.conn.conn.status().unwrap().duration;
+ let (pos, _) = app.conn.conn.status().unwrap().time.unwrap();
+ let pos: i64 = (pos.as_secs() - 2).try_into().unwrap();
+ app.conn.conn.seek(2, pos )?;
}
_ => {}
}