From 859003fc65fe9d3a863f4c2f826d8990866d2c94 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 21 Jun 2025 01:01:53 +0000 Subject: [PATCH] Set meta bug fix (#27) Reviewed-on: https://git.kundeng.us/phoenix/icarus_meta/pulls/27 Co-authored-by: phoenix Co-committed-by: phoenix --- src/meta.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/meta.rs b/src/meta.rs index c73da04..ef1f490 100644 --- a/src/meta.rs +++ b/src/meta.rs @@ -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 { 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,