rmptui9daeca9
pl_append remove get_full_path() usage of Queue #7
+9 −10
1 file changed
- M src/event/pl_append_keys.rs +9 −10
| @@ -24,16 +24,15 @@ pub fn hande_pl_append_keys(key_event: KeyEvent, app: &mut App) -> AppResult<()> | |||
| 24 | 24 | return Ok(()); | |
| 25 | 25 | } | |
| 26 | 26 | ||
| 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 | + | } | |
| 37 | 36 | } | |
| 38 | 37 | } | |
| 39 | 38 | } | |