pl_append remove get_full_path() usage of Queue #7

This commit is contained in:
krolxon 2024-05-31 12:36:41 +05:30
parent 7b14b68164
commit def91deabe
1 changed files with 9 additions and 10 deletions

View File

@ -24,16 +24,15 @@ pub fn hande_pl_append_keys(key_event: KeyEvent, app: &mut App) -> AppResult<()>
return Ok(()); return Ok(());
} }
let short_path = &app.queue_list.get_item_at_current_index().file; if let Ok(songs) = app.conn.conn.songs(app.queue_list.index as u32) {
let option_song = songs.first();
if let Some(full_path) = app.conn.get_full_path(short_path) { if let Some(song) = option_song {
let song = app.conn.get_song_with_only_filename(&full_path); if *pl_name == "Current Playlist" {
app.conn.conn.push(&song)?;
if *pl_name == "Current Playlist" { app.update_queue();
app.conn.conn.push(&song)?; } else {
app.update_queue(); app.conn.add_to_playlist(pl_name, &song)?;
} else { }
app.conn.add_to_playlist(pl_name, &song)?;
} }
} }
} }