updated dependencies and made small changes to the library

This commit is contained in:
MrDulfin 2024-03-30 00:55:56 -04:00
parent c0f71e0741
commit 7da0b1a1db
2 changed files with 11 additions and 9 deletions

View file

@ -32,9 +32,8 @@ leb128 = "0.2.5"
urlencoding = "2.1.3"
m3u8-rs = "5.0.5"
thiserror = "1.0.56"
font = "0.27.0"
uuid = { version = "1.6.1", features = ["v4", "serde"]}
uuid = { version = "1.6.1", features = ["v4", "serde"] }
serde_json = "1.0.111"
deunicode = "1.4.2"
opener = { version = "0.7.0", features = ["reveal"]}
tempfile = "3.10.1"
opener = { version = "0.7.0", features = ["reveal"] }
tempfile = "3.10.1"

View file

@ -7,7 +7,7 @@ use std::collections::BTreeMap;
use std::error::Error;
use std::io::Write;
use std::ops::ControlFlow::{Break, Continue};
use std::thread::sleep;
// Files
use file_format::{FileFormat, Kind};
@ -426,6 +426,8 @@ impl Song {
Ok(tracks)
}
/// Takes the AlbumArt[index] and opens it in the native file viewer
pub fn open_album_art(&self, index: usize, temp_dir: &TempDir) -> Result<(), Box<dyn Error>> {
use opener::open;
use urlencoding::decode;
@ -446,14 +448,14 @@ impl Song {
let blank_tag = &lofty::Tag::new(TagType::Id3v2);
let tagged_file: lofty::TaggedFile;
#[cfg(windows)]
#[cfg(target_family = "windows")]
let uri = urlencoding::decode(
match self.location.as_uri().strip_prefix("file:///") {
Some(str) => str,
None => return Err("invalid path.. again?".into())
})?.into_owned();
#[cfg(unix)]
#[cfg(target_family = "unix")]
let uri = urlencoding::decode(
match self.location.as_uri().strip_prefix("file://") {
Some(str) => str,
@ -1149,13 +1151,14 @@ mod test {
#[test]
fn get_art_test() {
let s = Song::from_file(Path::new(".\\test-config\\music\\Snail_s House - Hot Milk.mp3")).unwrap();
let s = Song::from_file(Path::new("")).unwrap();
let dir = &TempDir::new().unwrap();
let now = Instant::now();
_ = s.open_album_art(0, dir).inspect_err(|e| println!("{e:?}"));
_ = s.open_album_art(1, dir).inspect_err(|e| println!("{e:?}"));
println!("{}ms", now.elapsed().as_millis() );
sleep(Duration::from_secs(1));
sleep(Duration::from_secs(20));
}
}