Krolyxon
Commit 9922b1c

rmptui9922b1c

workaround for #7, fix error when using 'Space'

Author
krolxon
Date
2024-05-31 12:51 +0530
Parent
9daeca9
Commit
9922b1c48dc29fc00c6c4a61a786950cff55c54e

+10 −8

1 file changed

  1. M src/app.rs +10 −8
M src/app.rs View
@@ -139,15 +139,17 @@ impl App {
139139 }
140140
141141 if !status {
142− let path = self.browser.prev_path.to_string()
143− + "/"
144− + self.browser.path.as_str()
145− + "/"
146− + content;
147− let full_path = path.strip_prefix("././").unwrap_or_else(|| "");
148−
149− let song = self.conn.get_song_with_only_filename(full_path);
142+ let mut filename = format!("{}/{}", self.browser.path, content);
143+
144+ // Remove "./" from the beginning of filename
145+ filename.remove(0);
146+ filename.remove(0);
147+
148+ let song = self.conn.get_song_with_only_filename(&filename);
150149 self.conn.conn.push(&song)?;
150+
151+ // updating queue, to avoid multiple pushes of the same songs if we enter multiple times before the queue gets updated
152+ self.update_queue();
151153 }
152154 }
153155