Skip to content

Commit

Permalink
New tags: Copyright, ISRC, Artists, AlbumArtists
Browse files Browse the repository at this point in the history
Also adds additional barcode tags to read from
  • Loading branch information
JuniorJPDJ committed May 11, 2021
1 parent f0fa999 commit b8fbf27
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
28 changes: 28 additions & 0 deletions mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,12 @@ def update(self, dict):
StorageStyle('ARTIST'),
ASFStorageStyle('Author'),
)
artists = ListMediaField(
MP3ListDescStorageStyle(desc=u'ARTISTS'),
MP4ListStorageStyle('----:com.apple.iTunes:ARTISTS'),
ListStorageStyle('ARTISTS'),
ASFStorageStyle('WM/ARTISTS'),
)
album = MediaField(
MP3StorageStyle('TALB'),
MP4StorageStyle('\xa9alb'),
Expand Down Expand Up @@ -1759,6 +1765,12 @@ def update(self, dict):
ASFStorageStyle('WM/Comments'),
ASFStorageStyle('Description')
)
copyright = MediaField(
MP3StorageStyle('TCOP'),
MP4StorageStyle('cprt'),
StorageStyle('COPYRIGHT'),
ASFStorageStyle('Copyright'),
)
bpm = MediaField(
MP3StorageStyle('TBPM'),
MP4StorageStyle('tmpo', as_type=int),
Expand All @@ -1780,6 +1792,12 @@ def update(self, dict):
StorageStyle('ALBUMARTIST'),
ASFStorageStyle('WM/AlbumArtist'),
)
albumartists = ListMediaField(
MP3ListDescStorageStyle(desc=u'ALBUMARTISTS'),
MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTS'),
ListStorageStyle('ALBUMARTISTS'),
ASFStorageStyle('WM/AlbumArtists'),
)
albumtype = MediaField(
MP3DescStorageStyle(u'MusicBrainz Album Type'),
MP4StorageStyle('----:com.apple.iTunes:MusicBrainz Album Type'),
Expand Down Expand Up @@ -1824,8 +1842,18 @@ def update(self, dict):
MP3DescStorageStyle(u'BARCODE'),
MP4StorageStyle('----:com.apple.iTunes:BARCODE'),
StorageStyle('BARCODE'),
StorageStyle('UPC', read_only=True),
StorageStyle('EAN/UPN', read_only=True),
StorageStyle('EAN', read_only=True),
StorageStyle('UPN', read_only=True),
ASFStorageStyle('WM/Barcode'),
)
isrc = MediaField(
MP3StorageStyle(u'TSRC'),
MP4StorageStyle('----:com.apple.iTunes:ISRC'),
StorageStyle('ISRC'),
ASFStorageStyle('WM/ISRC'),
)
disctitle = MediaField(
MP3StorageStyle('TSST'),
MP4StorageStyle('----:com.apple.iTunes:DISCSUBTITLE'),
Expand Down
9 changes: 6 additions & 3 deletions test/test_mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin,
'disctotal',
'lyrics',
'comments',
'copyright',
'bpm',
'comp',
'mb_trackid',
Expand All @@ -388,6 +389,7 @@ class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin,
'asin',
'catalognum',
'barcode',
'isrc',
'disctitle',
'script',
'language',
Expand Down Expand Up @@ -711,7 +713,8 @@ def _generate_tags(self, base=None):
for key in ['disc', 'disctotal', 'track', 'tracktotal', 'bpm']:
tags[key] = 1

for key in ['mb_artistid', 'mb_albumartistid']:
for key in ['artists', 'albumartists', 'mb_artistid',
'mb_albumartistid']:
tags[key] = ['multival', 'test']

tags['art'] = self.jpg_data
Expand Down Expand Up @@ -985,8 +988,8 @@ def test_properties_from_readable_fields(self):

def test_known_fields(self):
fields = list(ReadWriteTestBase.tag_fields)
fields.extend(('encoder', 'images', 'genres', 'albumtype',
'mb_artistid', 'mb_albumartistid'))
fields.extend(('encoder', 'images', 'genres', 'albumtype', 'artists',
'albumartists', 'mb_artistid', 'mb_albumartistid'))
assertCountEqual(self, MediaFile.fields(), fields)

def test_fields_in_readable_fields(self):
Expand Down

0 comments on commit b8fbf27

Please sign in to comment.