Skip to content

Commit

Permalink
Add ID3v2BinaryDataFrame [#22]
Browse files Browse the repository at this point in the history
  • Loading branch information
thebigmunch committed Mar 2, 2020
1 parent 327469b commit b4d07b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org).
* ``OggOpus``.
* ``OggOpusVorbisComments``.
* ``AudioMetadataWarning``.
* ``ID3v2BinaryDataFrame``.

### Changed

Expand Down
13 changes: 12 additions & 1 deletion src/audio_metadata/formats/id3v2_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

__all__ = [
'ID3v2BaseFrame',
'ID3v2BinaryDataFrame',
'ID3v2Comment',
'ID3v2CommentFrame',
'ID3v2Frame',
Expand Down Expand Up @@ -111,6 +112,14 @@ class ID3v2BaseFrame(AttrMapping):
id = attrib() # noqa


@attrs(
repr=False,
kw_only=True,
)
class ID3v2BinaryDataFrame(AttrMapping):
value = attrib()


@attrs(
repr=False,
kw_only=True,
Expand Down Expand Up @@ -513,7 +522,9 @@ def load(cls, data, struct_pattern, size_len, per_byte):

# TODO: Move logic into frame classes?
kwargs = {'id': frame_id}
if frame_type is ID3v2CommentFrame:
if frame_type is ID3v2BinaryDataFrame:
kwargs['value'] = frame_data
elif frame_type is ID3v2CommentFrame:
encoding = determine_encoding(frame_data[0:1])

values = split_encoded(frame_data[4:], encoding)
Expand Down

0 comments on commit b4d07b5

Please sign in to comment.