aboutsummaryrefslogtreecommitdiff
path: root/src/connection.rs
diff options
context:
space:
mode:
authorkrolxon <krolyxon@tutanota.com>2024-04-29 15:00:15 +0530
committerkrolxon <krolyxon@tutanota.com>2024-04-29 15:00:15 +0530
commit49934311862747e33550ccfebbc9cbbef6a3455d (patch)
treed3380648678d01ecd38aec6ee19397d6f3221414 /src/connection.rs
parent51fbf426531fc9843afbbd7736eb5c3564f39658 (diff)
add metadata in directory tree
Diffstat (limited to 'src/connection.rs')
-rwxr-xr-xsrc/connection.rs29
1 files changed, 2 insertions, 27 deletions
diff --git a/src/connection.rs b/src/connection.rs
index 7327bb9..5cba89d 100755
--- a/src/connection.rs
+++ b/src/connection.rs
@@ -27,14 +27,7 @@ impl Connection {
let empty_song = Song {
file: "No Song playing or in Queue".to_string(),
- artist: None,
- title: None,
- duration: None,
- last_mod: None,
- name: None,
- place: None,
- range: None,
- tags: vec![("".to_string(), "".to_string())],
+ ..Default::default()
};
let songs_filenames: Vec<String> = conn
@@ -70,7 +63,6 @@ impl Connection {
/// Fzf prompt for selecting song
pub fn play_fzf(&mut self) -> Result<()> {
is_installed("fzf").map_err(|ex| ex)?;
-
let ss = &self.songs_filenames;
let fzf_choice = rust_fzf::select(ss.clone(), Vec::new()).unwrap();
let index = get_choice_index(&self.songs_filenames, fzf_choice.get(0).unwrap());
@@ -174,29 +166,12 @@ impl Connection {
pub fn get_song_with_only_filename(&self, filename: &str) -> Song {
Song {
file: filename.to_string(),
- artist: None,
- title: None,
- duration: None,
- last_mod: None,
- name: None,
- place: None,
- range: None,
- tags: vec![("".to_string(), "".to_string())],
+ ..Default::default()
}
}
/// Given a song name from a directory, it returns the full path of the song in the database
pub fn get_full_path(&self, short_path: &str) -> Option<String> {
- // let list = self
- // .songs_filenames
- // .iter()
- // .map(|f| f.as_str())
- // .collect::<Vec<&str>>();
- // let (filename, _) = rust_fuzzy_search::fuzzy_search_sorted(&short_path, &list)
- // .get(0)
- // .unwrap()
- // .clone();
-
for (i, f) in self.songs_filenames.iter().enumerate() {
if f.contains(short_path) {
return Some(self.songs_filenames.get(i).unwrap().to_string());