Add test to make sure it works
All checks were successful
Rust Build / Check (pull_request) Successful in 39s
Rust Build / Test Suite (pull_request) Successful in 42s
Rust Build / Rustfmt (pull_request) Successful in 35s
Rust Build / Clippy (pull_request) Successful in 36s
Rust Build / build (pull_request) Successful in 42s
All checks were successful
Rust Build / Check (pull_request) Successful in 39s
Rust Build / Test Suite (pull_request) Successful in 42s
Rust Build / Rustfmt (pull_request) Successful in 35s
Rust Build / Clippy (pull_request) Successful in 36s
Rust Build / build (pull_request) Successful in 42s
This commit is contained in:
30
src/meta.rs
30
src/meta.rs
@@ -23,7 +23,7 @@ pub mod coverart {
|
|||||||
song_filepath: &String,
|
song_filepath: &String,
|
||||||
coverart_filepath: &String,
|
coverart_filepath: &String,
|
||||||
) -> Result<Vec<u8>, std::io::Error> {
|
) -> Result<Vec<u8>, std::io::Error> {
|
||||||
let _coverart_path = std::path::Path::new(coverart_filepath);
|
let coverart_path = std::path::Path::new(coverart_filepath);
|
||||||
|
|
||||||
match std::fs::File::open(song_filepath) {
|
match std::fs::File::open(song_filepath) {
|
||||||
Ok(mut file) => {
|
Ok(mut file) => {
|
||||||
@@ -31,7 +31,32 @@ pub mod coverart {
|
|||||||
&mut file,
|
&mut file,
|
||||||
lofty::config::ParseOptions::new(),
|
lofty::config::ParseOptions::new(),
|
||||||
) {
|
) {
|
||||||
Ok(flac_file) => {
|
Ok(mut flac_file) => {
|
||||||
|
let mut coverart_file = std::fs::File::open(coverart_path).unwrap();
|
||||||
|
match lofty::picture::Picture::from_reader(&mut coverart_file) {
|
||||||
|
Ok(pic) => {
|
||||||
|
match lofty::picture::PictureInformation::from_picture(&pic) {
|
||||||
|
Ok(info) => {
|
||||||
|
flac_file.set_picture(0, pic, info);
|
||||||
|
Ok(Vec::new())
|
||||||
|
}
|
||||||
|
Err(err) => Err(std::io::Error::new(
|
||||||
|
std::io::ErrorKind::InvalidData,
|
||||||
|
err.to_string(),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => Err(std::io::Error::new(
|
||||||
|
std::io::ErrorKind::InvalidData,
|
||||||
|
err.to_string(),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
let mut bytes: Vec<u8> = Vec::new();
|
||||||
|
lofty::picture::Picture::from_flac_bytes(bytes, false, lofty::config::ParsingMode::BestAttempt);
|
||||||
|
flac_file.set_picture(0, picture, info);
|
||||||
|
|
||||||
let pictures = flac_file.pictures();
|
let pictures = flac_file.pictures();
|
||||||
let res = pictures.to_vec();
|
let res = pictures.to_vec();
|
||||||
if !res.is_empty() {
|
if !res.is_empty() {
|
||||||
@@ -40,6 +65,7 @@ pub mod coverart {
|
|||||||
} else {
|
} else {
|
||||||
Ok(Vec::new())
|
Ok(Vec::new())
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
Err(err) => Err(std::io::Error::new(
|
Err(err) => Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::InvalidData,
|
std::io::ErrorKind::InvalidData,
|
||||||
|
Reference in New Issue
Block a user