Serial-ATA / lofty-rs

Audio metadata library
Apache License 2.0
187 stars 35 forks source link

Add a `Picture` interface to `ApeTag` #280

Open Serial-ATA opened 11 months ago

Serial-ATA commented 11 months ago

Summary

There is no easy way to interact with Pictures when using ApeTag. They are currently treated as any other item with ItemValue::Binary.

We could very easily split them off from the other items and store them separately, like we do for VorbisComments.

API design

impl ApeTag {
    /// Removes PictureType::Icon and PictureType::OtherIcon like Id3v2Tag and VorbisComments
    fn insert_picture(&mut self, picture: Picture) -> Option<Picture>;
    fn pictures(&self) -> impl Iterator<Item = &Picture>;
    fn remove_picture_type(&mut self, picture_type: PictureType) -> impl Iterator<Item = Picture>;
}