workaround for #7, fix error when using 'Space'
This commit is contained in:
parent
6ae0aca868
commit
7b14b68164
23
src/app.rs
23
src/app.rs
|
|
@ -1,6 +1,6 @@
|
||||||
use std::time::Duration;
|
use std::{path::Path, time::Duration};
|
||||||
|
|
||||||
use crate::browser::FileBrowser;
|
use crate::browser::{FileBrowser, FileExtension};
|
||||||
use crate::connection::Connection;
|
use crate::connection::Connection;
|
||||||
use crate::list::ContentList;
|
use crate::list::ContentList;
|
||||||
use crate::ui::InputMode;
|
use crate::ui::InputMode;
|
||||||
|
|
@ -117,14 +117,15 @@ impl App {
|
||||||
let songs = self.conn.conn.listfiles(&file).unwrap_or_default();
|
let songs = self.conn.conn.listfiles(&file).unwrap_or_default();
|
||||||
for (t, f) in songs.iter() {
|
for (t, f) in songs.iter() {
|
||||||
if t == "file" {
|
if t == "file" {
|
||||||
let path = self.browser.prev_path.to_string()
|
if Path::new(&f).has_extension(&[
|
||||||
+ "/"
|
"mp3", "ogg", "flac", "m4a", "wav", "aac", "opus", "ape", "wma",
|
||||||
+ self.browser.path.as_str()
|
"mpc", "aiff", "dff", "mp2", "mka",
|
||||||
+ "/"
|
]) {
|
||||||
+ f;
|
let path = file.clone() + "/" + f;
|
||||||
let full_path = path.strip_prefix("./").unwrap_or_else(|| "");
|
let full_path = path.strip_prefix("./").unwrap_or_else(|| "");
|
||||||
let song = self.conn.get_song_with_only_filename(full_path);
|
let song = self.conn.get_song_with_only_filename(&full_path);
|
||||||
self.conn.conn.push(&song)?;
|
self.conn.conn.push(&song)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if content_type == "file" {
|
} else if content_type == "file" {
|
||||||
|
|
@ -143,7 +144,7 @@ impl App {
|
||||||
+ self.browser.path.as_str()
|
+ self.browser.path.as_str()
|
||||||
+ "/"
|
+ "/"
|
||||||
+ content;
|
+ content;
|
||||||
let full_path = path.strip_prefix("./").unwrap_or_else(|| "");
|
let full_path = path.strip_prefix("././").unwrap_or_else(|| "");
|
||||||
|
|
||||||
let song = self.conn.get_song_with_only_filename(full_path);
|
let song = self.conn.get_song_with_only_filename(full_path);
|
||||||
self.conn.conn.push(&song)?;
|
self.conn.conn.push(&song)?;
|
||||||
|
|
|
||||||
Reference in New Issue