mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 06:34:18 +00:00
Add TagExt::clear
This commit is contained in:
parent
4b51453ce7
commit
12b919871d
10 changed files with 40 additions and 1 deletions
|
@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- **MP4**: `mp4::AudioObjectType`
|
- **MP4**: `mp4::AudioObjectType`
|
||||||
- This new type is used in `mp4::Mp4Properties`, accessible with `Mp4Properties::audio_object_type`.
|
- This new type is used in `mp4::Mp4Properties`, accessible with `Mp4Properties::audio_object_type`.
|
||||||
This provides additional information for the type of audio being dealt with.
|
This provides additional information for the type of audio being dealt with.
|
||||||
|
- `TagExt::clear`
|
||||||
|
- This allows tags to be cleared of any items or pictures, while retaining any flags (if applicable)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- **MP4**: Sample rates are now retrieved from the [audio specific config](https://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config) (if possible).
|
- **MP4**: Sample rates are now retrieved from the [audio specific config](https://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config) (if possible).
|
||||||
|
|
|
@ -171,6 +171,10 @@ impl TagExt for ApeTag {
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||||
TagType::Ape.remove_from(file)
|
TagType::Ape.remove_from(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.items.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ApeTag> for Tag {
|
impl From<ApeTag> for Tag {
|
||||||
|
|
|
@ -148,6 +148,10 @@ impl TagExt for Id3v1Tag {
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||||
TagType::Id3v1.remove_from(file)
|
TagType::Id3v1.remove_from(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
*self = Self::default();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Id3v1Tag> for Tag {
|
impl From<Id3v1Tag> for Tag {
|
||||||
|
|
|
@ -318,6 +318,10 @@ impl TagExt for Id3v2Tag {
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||||
TagType::Id3v2.remove_from(file)
|
TagType::Id3v2.remove_from(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.frames.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Id3v2Tag> for Tag {
|
impl From<Id3v2Tag> for Tag {
|
||||||
|
|
|
@ -169,6 +169,10 @@ impl TagExt for AiffTextChunks {
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||||
TagType::AiffText.remove_from(file)
|
TagType::AiffText.remove_from(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
*self = Self::default();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<AiffTextChunks> for Tag {
|
impl From<AiffTextChunks> for Tag {
|
||||||
|
|
|
@ -127,6 +127,10 @@ impl TagExt for RiffInfoList {
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||||
TagType::RiffInfo.remove_from(file)
|
TagType::RiffInfo.remove_from(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.items.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<RiffInfoList> for Tag {
|
impl From<RiffInfoList> for Tag {
|
||||||
|
|
|
@ -250,6 +250,10 @@ impl TagExt for Ilst {
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||||
TagType::Mp4Ilst.remove_from(file)
|
TagType::Mp4Ilst.remove_from(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.atoms.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Ilst> for Tag {
|
impl From<Ilst> for Tag {
|
||||||
|
|
|
@ -194,6 +194,11 @@ impl TagExt for VorbisComments {
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||||
TagType::VorbisComments.remove_from(file)
|
TagType::VorbisComments.remove_from(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.items.clear();
|
||||||
|
self.pictures.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<VorbisComments> for Tag {
|
impl From<VorbisComments> for Tag {
|
||||||
|
|
|
@ -395,6 +395,11 @@ impl TagExt for Tag {
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err> {
|
||||||
self.tag_type.remove_from(file)
|
self.tag_type.remove_from(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clear(&mut self) {
|
||||||
|
self.items.clear();
|
||||||
|
self.pictures.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The tag's format
|
/// The tag's format
|
||||||
|
|
|
@ -129,5 +129,8 @@ pub trait TagExt: Accessor + Into<Tag> + Sized {
|
||||||
/// * It is unable to write to the file
|
/// * It is unable to write to the file
|
||||||
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err>;
|
fn remove_from(&self, file: &mut File) -> std::result::Result<(), Self::Err>;
|
||||||
|
|
||||||
// TODO: clear method
|
/// Clear the tag, removing all items
|
||||||
|
///
|
||||||
|
/// NOTE: This will **not** remove any format-specific extras, such as flags
|
||||||
|
fn clear(&mut self);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue