Skip to content

Commit

Permalink
Merge pull request #47 from JuniorJPDJ/albumartists
Browse files Browse the repository at this point in the history
More tag variants for `albumartists`
  • Loading branch information
sampsyo authored Aug 20, 2022
2 parents b5920d0 + d7a2b71 commit b354a3d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ v0.10.0
``languages``.
- The ``catalognum`` property now refers to additional file tags named
``CATALOGID`` and ``DISCOGS_CATALOG`` (but only for reading, not writing).
- The multi-valued ``albumartists`` property now refers to additional file
tags named ``ALBUM_ARTIST`` and ``ALBUM ARTISTS`` (the ``ALBUM ARTISTS``
is being used only for reading).
- The ``ListMediaField`` class now doesn't concatenate multiple lists if
found, properties using this class now overwrite each other when
multiple are defined like other properties.
v0.9.0
''''''
Expand Down
18 changes: 14 additions & 4 deletions mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,11 +1312,12 @@ class ListMediaField(MediaField):
Uses ``get_list`` and set_list`` methods of its ``StorageStyle``
strategies to do the actual work.
"""
def __get__(self, mediafile, _):
values = []
def __get__(self, mediafile, _=None):
for style in self.styles(mediafile.mgfile):
values.extend(style.get_list(mediafile.mgfile))
return [_safe_cast(self.out_type, value) for value in values]
values = style.get_list(mediafile.mgfile)
if values:
return [_safe_cast(self.out_type, value) for value in values]
return []

def __set__(self, mediafile, values):
for style in self.styles(mediafile.mgfile):
Expand Down Expand Up @@ -1909,13 +1910,22 @@ def as_dict(self):
MP3StorageStyle('TPE2'),
MP4StorageStyle('aART'),
StorageStyle('ALBUM ARTIST'),
StorageStyle('ALBUM_ARTIST'),
StorageStyle('ALBUMARTIST'),
ASFStorageStyle('WM/AlbumArtist'),
)
albumartists = ListMediaField(
MP3ListDescStorageStyle(desc=u'ALBUMARTISTS'),
MP3ListDescStorageStyle(desc=u'ALBUM_ARTISTS'),
MP3ListDescStorageStyle(desc=u'ALBUM ARTISTS', read_only=True),
MP4ListStorageStyle('----:com.apple.iTunes:ALBUMARTISTS'),
MP4ListStorageStyle('----:com.apple.iTunes:ALBUM_ARTISTS'),
MP4ListStorageStyle(
'----:com.apple.iTunes:ALBUM ARTISTS', read_only=True
),
ListStorageStyle('ALBUMARTISTS'),
ListStorageStyle('ALBUM_ARTISTS'),
ListStorageStyle('ALBUM ARTISTS', read_only=True),
ASFStorageStyle('WM/AlbumArtists'),
)
albumtypes = ListMediaField(
Expand Down

0 comments on commit b354a3d

Please sign in to comment.