mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 01:26:43 +01:00
write to file!
This commit is contained in:
parent
0d1d4b6e9a
commit
bba8d39872
1 changed files with 3 additions and 1 deletions
|
|
@ -88,13 +88,15 @@ impl Perch {
|
|||
}
|
||||
/// Write all modified tags
|
||||
pub(crate) fn save_all (&mut self) -> Usually<()> {
|
||||
use std::fs::File;
|
||||
use lofty::{tag::TagExt, config::WriteOptions};
|
||||
for entry in self.entries.iter_mut() {
|
||||
if let Metadata::Music {
|
||||
modified_tag: Some(modified_tag), ..
|
||||
} = &mut *entry.info.write().unwrap() {
|
||||
let tag = modified_tag.read().unwrap();
|
||||
let mut file = std::fs::File::open(entry.path.as_path())?;
|
||||
let path = entry.path.as_path();
|
||||
let mut file = File::options().read(true).write(true).open(path)?;
|
||||
tag.save_to(&mut file, WriteOptions::default())?;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue