Krolyxon
Commit 9daeca9

rmptui9daeca9

pl_append remove get_full_path() usage of Queue #7

Author
krolxon
Date
2024-05-31 12:36 +0530
Parent
e181181
Commit
9daeca96151ea4f9cb89bafe255ae9f88df1928e

+9 −10

1 file changed

  1. M src/event/pl_append_keys.rs +9 −10
M src/event/pl_append_keys.rs View
@@ -24,16 +24,15 @@ pub fn hande_pl_append_keys(key_event: KeyEvent, app: &mut App) -> AppResult<()>
2424 return Ok(());
2525 }
2626
27− let short_path = &app.queue_list.get_item_at_current_index().file;
28−
29− if let Some(full_path) = app.conn.get_full_path(short_path) {
30− let song = app.conn.get_song_with_only_filename(&full_path);
31−
32− if *pl_name == "Current Playlist" {
33− app.conn.conn.push(&song)?;
34− app.update_queue();
35− } else {
36− app.conn.add_to_playlist(pl_name, &song)?;
27+ if let Ok(songs) = app.conn.conn.songs(app.queue_list.index as u32) {
28+ let option_song = songs.first();
29+ if let Some(song) = option_song {
30+ if *pl_name == "Current Playlist" {
31+ app.conn.conn.push(&song)?;
32+ app.update_queue();
33+ } else {
34+ app.conn.add_to_playlist(pl_name, &song)?;
35+ }
3736 }
3837 }
3938 }