mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-14 06:32:33 +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)?;
|
||||
|
||||
create_comments(writer, &mut count, items)?;
|
||||
create_comments(writer, &mut count, &mut peek)?;
|
||||
|
||||
let len = (writer.get_ref().len() - 1) as u32;
|
||||
|
||||
|
|
|
@ -193,8 +193,10 @@ impl From<Tag> for VorbisComments {
|
|||
_ => continue,
|
||||
};
|
||||
|
||||
// Safe to unwrap since all ItemKeys map in Vorbis comments
|
||||
let key = item.key().map_key(TagType::VorbisComments, true).unwrap();
|
||||
let key = match item.key().map_key(TagType::VorbisComments, true) {
|
||||
None => continue,
|
||||
Some(k) => k,
|
||||
};
|
||||
|
||||
vorbis_comments
|
||||
.items
|
||||
|
@ -249,9 +251,10 @@ impl<'a> Into<VorbisCommentsRef<'a>> for &'a Tag {
|
|||
let vendor = self.get_string(&ItemKey::EncoderSoftware).unwrap_or("");
|
||||
|
||||
let items = self.items.iter().filter_map(|i| match i.value() {
|
||||
ItemValue::Text(val) | ItemValue::Locator(val) => {
|
||||
Some((i.key().map_key(TagType::VorbisComments, true).unwrap(), val))
|
||||
},
|
||||
ItemValue::Text(val) | ItemValue::Locator(val) => i
|
||||
.key()
|
||||
.map_key(TagType::VorbisComments, true)
|
||||
.map(|key| (key, val)),
|
||||
_ => None,
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue