From 9c30356a3e0b333bab32ea1a866738fbab14ea11 Mon Sep 17 00:00:00 2001 From: krolxon Date: Tue, 30 Apr 2024 23:10:46 +0530 Subject: move queue into its own file, and optimize it --- src/handler.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/handler.rs') diff --git a/src/handler.rs b/src/handler.rs index 86ab7cb..e731543 100755 --- a/src/handler.rs +++ b/src/handler.rs @@ -34,13 +34,13 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { .queue_list .list .iter() - .map(|f| f.as_str()) + .map(|f| f.file.as_str()) .collect::>(); let res: Vec<(&str, f32)> = fuzzy_search_sorted(&app.search_input, &list); let res = res.iter().map(|(x, _)| *x).collect::>(); for (i, item) in app.queue_list.list.iter().enumerate() { - if item.contains(res.get(0).unwrap()) { + if item.file.contains(res.get(0).unwrap()) { app.queue_list.index = i; } } @@ -162,7 +162,7 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { match app.selected_tab { SelectedTab::Queue => { s_index = app.queue_list.index; - let short_path = app.queue_list.list.get(s_index).unwrap().to_string(); + let short_path = &app.queue_list.list.get(s_index).unwrap().file; if let Some(full_path) = app.conn.get_full_path(&short_path) { let song = app.conn.get_song_with_only_filename(&full_path); -- cgit v1.2.3