mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2025-01-20 16:13:55 +00:00
Fix FLAC writing
This commit is contained in:
parent
bec96a139b
commit
b42b423c50
2 changed files with 9 additions and 6 deletions
|
@ -125,7 +125,7 @@ fn create_comment_block(
|
||||||
|
|
||||||
writer.write_u32::<LittleEndian>(count)?;
|
writer.write_u32::<LittleEndian>(count)?;
|
||||||
|
|
||||||
create_comments(writer, &mut count, items)?;
|
create_comments(writer, &mut count, &mut peek)?;
|
||||||
|
|
||||||
let len = (writer.get_ref().len() - 1) as u32;
|
let len = (writer.get_ref().len() - 1) as u32;
|
||||||
|
|
||||||
|
|
|
@ -193,8 +193,10 @@ impl From<Tag> for VorbisComments {
|
||||||
_ => continue,
|
_ => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Safe to unwrap since all ItemKeys map in Vorbis comments
|
let key = match item.key().map_key(TagType::VorbisComments, true) {
|
||||||
let key = item.key().map_key(TagType::VorbisComments, true).unwrap();
|
None => continue,
|
||||||
|
Some(k) => k,
|
||||||
|
};
|
||||||
|
|
||||||
vorbis_comments
|
vorbis_comments
|
||||||
.items
|
.items
|
||||||
|
@ -249,9 +251,10 @@ impl<'a> Into<VorbisCommentsRef<'a>> for &'a Tag {
|
||||||
let vendor = self.get_string(&ItemKey::EncoderSoftware).unwrap_or("");
|
let vendor = self.get_string(&ItemKey::EncoderSoftware).unwrap_or("");
|
||||||
|
|
||||||
let items = self.items.iter().filter_map(|i| match i.value() {
|
let items = self.items.iter().filter_map(|i| match i.value() {
|
||||||
ItemValue::Text(val) | ItemValue::Locator(val) => {
|
ItemValue::Text(val) | ItemValue::Locator(val) => i
|
||||||
Some((i.key().map_key(TagType::VorbisComments, true).unwrap(), val))
|
.key()
|
||||||
},
|
.map_key(TagType::VorbisComments, true)
|
||||||
|
.map(|key| (key, val)),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue