Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID3v2: Support more frames #236

Merged
merged 12 commits into from
Jul 20, 2023
Merged

ID3v2: Support more frames #236

merged 12 commits into from
Jul 20, 2023

Conversation

Serial-ATA
Copy link
Owner

@Serial-ATA Serial-ATA commented Jul 18, 2023

This adds support for the following frames: "RVA2", "OWNE", "ETCO", and "PRIV".

Additionally, this changes Id3v2Tag::remove to return the frame(s) removed, and Id3v2Tag::insert to check for frames that only meant to appear once in a file, replacing if necessary. Those frames are: "MCDI", "ETCO", "MLLT", "SYTC", "RVRB", "PCNT", "RBUF", "POSS", "OWNE", "SEEK", and "ASPI".

Part of #189

/// Represents an "RVA2" frame
RelativeVolumeAdjustment(RelativeVolumeAdjustmentFrame),
/// Unique file identifier
UniqueFileIdentifier(UniqueFileIdentifierFrame),
Copy link
Contributor

@uklotzde uklotzde Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. This is used by many MusicBrainz tags needed for http://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html#id21

})
}

/// Used for errors in write::frame::verify_frame
pub(super) fn name(&self) -> &'static str {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, looks like they have some useful derives. There are probably a few places they could be used. I might look into it eventually.

@@ -320,8 +331,18 @@ impl Id3v2Tag {
}

/// Removes a [`Frame`] by id
pub fn remove(&mut self, id: &str) {
self.frames.retain(|f| f.id_str() != id)
pub fn remove(&mut self, id: &str) -> impl Iterator<Item = Frame<'static>> + '_ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing a FrameId<'_> would be type safe and avoid the somehow unrelated eq_ignore_ascii_case(). Otherwise we should extract a function that explcitly matches FrameId with str consistently instead of inlining this code here and probably elsewhere.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll change that soon in a follow up PR. I don't know how many places it's used right now.

@Serial-ATA Serial-ATA merged commit a7af2f7 into main Jul 20, 2023
12 checks passed
@Serial-ATA Serial-ATA deleted the more-id3v2-frames branch July 20, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants