Skip to content

Commit

Permalink
Merge pull request #60 from jeandeaual/new-list-fields
Browse files Browse the repository at this point in the history
Add new list fields set by MusicBrainz Picard
  • Loading branch information
sampsyo authored Feb 21, 2022
2 parents badcd22 + 2a4a77c commit 4f70ee8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
6 changes: 6 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ To copy tags from one MediaFile to another:
Changelog
---------
v0.10.0
''''''
- Add the properties ``albumtypes``, ``catalognums`` and
``languages``.
v0.9.0
''''''
Expand Down
32 changes: 19 additions & 13 deletions mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1918,13 +1918,15 @@ def as_dict(self):
ListStorageStyle('ALBUMARTISTS'),
ASFStorageStyle('WM/AlbumArtists'),
)
albumtype = MediaField(
MP3DescStorageStyle(u'MusicBrainz Album Type'),
MP4StorageStyle('----:com.apple.iTunes:MusicBrainz Album Type'),
StorageStyle('RELEASETYPE'),
StorageStyle('MUSICBRAINZ_ALBUMTYPE'),
albumtypes = ListMediaField(
MP3ListDescStorageStyle('MusicBrainz Album Type', split_v23=True),
MP4ListStorageStyle('----:com.apple.iTunes:MusicBrainz Album Type'),
ListStorageStyle('RELEASETYPE'),
ListStorageStyle('MUSICBRAINZ_ALBUMTYPE'),
ASFStorageStyle('MusicBrainz/Album Type'),
)
albumtype = albumtypes.single_field()

label = MediaField(
MP3StorageStyle('TPUB'),
MP4StorageStyle('----:com.apple.iTunes:LABEL'),
Expand Down Expand Up @@ -1952,12 +1954,14 @@ def as_dict(self):
StorageStyle('ASIN'),
ASFStorageStyle('MusicBrainz/ASIN'),
)
catalognum = MediaField(
MP3DescStorageStyle(u'CATALOGNUMBER'),
MP4StorageStyle('----:com.apple.iTunes:CATALOGNUMBER'),
StorageStyle('CATALOGNUMBER'),
catalognums = ListMediaField(
MP3ListDescStorageStyle('CATALOGNUMBER', split_v23=True),
MP4ListStorageStyle('----:com.apple.iTunes:CATALOGNUMBER'),
ListStorageStyle('CATALOGNUMBER'),
ASFStorageStyle('WM/CatalogNo'),
)
catalognum = catalognums.single_field()

barcode = MediaField(
MP3DescStorageStyle(u'BARCODE'),
MP4StorageStyle('----:com.apple.iTunes:BARCODE'),
Expand Down Expand Up @@ -1993,12 +1997,14 @@ def as_dict(self):
StorageStyle('SCRIPT'),
ASFStorageStyle('WM/Script'),
)
language = MediaField(
MP3StorageStyle('TLAN'),
MP4StorageStyle('----:com.apple.iTunes:LANGUAGE'),
StorageStyle('LANGUAGE'),
languages = ListMediaField(
MP3ListStorageStyle('TLAN'),
MP4ListStorageStyle('----:com.apple.iTunes:LANGUAGE'),
ListStorageStyle('LANGUAGE'),
ASFStorageStyle('WM/Language'),
)
language = languages.single_field()

country = MediaField(
MP3DescStorageStyle(u'MusicBrainz Album Release Country'),
MP4StorageStyle('----:com.apple.iTunes:MusicBrainz '
Expand Down
3 changes: 2 additions & 1 deletion test/test_mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,8 @@ def test_known_fields(self):
fields = list(ReadWriteTestBase.tag_fields)
fields.extend(
('encoder', 'images', 'genres', 'albumtype', 'artists',
'albumartists', 'url', 'mb_artistids', 'mb_albumartistids')
'albumartists', 'url', 'mb_artistids', 'mb_albumartistids',
'albumtypes', 'catalognums', 'languages')
)
assertCountEqual(self, MediaFile.fields(), fields)

Expand Down

0 comments on commit 4f70ee8

Please sign in to comment.