Set meta bug fix (#27)
All checks were successful
Release Tagging / release (push) Successful in 28s
Rust Build / Check (push) Successful in 27s
Rust Build / Test Suite (push) Successful in 27s
Rust Build / Rustfmt (push) Successful in 24s
Rust Build / Clippy (push) Successful in 27s
Rust Build / build (push) Successful in 34s
Rust Build / Check (pull_request) Successful in 25s
Rust Build / Test Suite (pull_request) Successful in 25s
Rust Build / Rustfmt (pull_request) Successful in 22s
Rust Build / Clippy (pull_request) Successful in 27s
Rust Build / build (pull_request) Successful in 30s

Reviewed-on: #27
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
2025-06-21 01:01:53 +00:00
committed by phoenix
parent 000639b0f8
commit 859003fc65

View File

@@ -135,9 +135,11 @@ pub mod coverart {
}
pub mod metadata {
// TODO: Move this at the end after the non-std crates
use crate::types;
use lofty::file::AudioFile;
use lofty::tag::Accessor;
use lofty::tag::TagExt;
pub fn get_meta(t: types::Type, filepath: &String) -> Result<String, std::io::Error> {
match std::fs::File::open(filepath) {
@@ -219,7 +221,14 @@ pub mod metadata {
}
};
Ok(value.to_owned())
match vb.save_to_path(filepath, lofty::config::WriteOptions::default())
{
Ok(_) => Ok(value.to_owned()),
Err(err) => Err(std::io::Error::new(
std::io::ErrorKind::InvalidData,
err.to_string(),
)),
}
}
None => Err(std::io::Error::new(
std::io::ErrorKind::InvalidData,