Simplify the whole thing by using taglist types and not bothering with the
config option or command to switch it on
This commit is contained in:
parent
0fcf492327
commit
8106399598
@ -19,4 +19,6 @@ TAGTYPE_LIST = [
|
||||
'MUSICBRAINZ_ALBUMID',
|
||||
'MUSICBRAINZ_ALBUMARTISTID',
|
||||
'MUSICBRAINZ_TRACKID',
|
||||
'X-AlbumUri',
|
||||
'X-AlbumImage',
|
||||
]
|
||||
|
||||
@ -97,6 +97,12 @@ def track_to_mpd_format(track, position=None, stream_title=None):
|
||||
if track.musicbrainz_id is not None:
|
||||
result.append(('MUSICBRAINZ_TRACKID', track.musicbrainz_id))
|
||||
|
||||
if track.album and track.album.uri:
|
||||
result.append(('X-AlbumUri', track.album.uri))
|
||||
if track.album and track.album.images:
|
||||
images = ';'.join(i for i in track.album.images if i is not '')
|
||||
result.append(('X-AlbumImage', images))
|
||||
|
||||
result = [element for element in result if _has_value(*element)]
|
||||
|
||||
return result
|
||||
|
||||
@ -14,7 +14,8 @@ class TrackMpdFormatTest(unittest.TestCase):
|
||||
name='a name',
|
||||
album=Album(
|
||||
name='an album', num_tracks=13,
|
||||
artists=[Artist(name='an other artist')]),
|
||||
artists=[Artist(name='an other artist')],
|
||||
uri='urischeme:album:12345', images=['image1', 'image2']),
|
||||
track_no=7,
|
||||
composers=[Artist(name='a composer')],
|
||||
performers=[Artist(name='a performer')],
|
||||
@ -76,8 +77,10 @@ class TrackMpdFormatTest(unittest.TestCase):
|
||||
self.assertIn(('Disc', 1), result)
|
||||
self.assertIn(('Pos', 9), result)
|
||||
self.assertIn(('Id', 122), result)
|
||||
self.assertIn(('X-AlbumUri', 'urischeme:album:12345'), result)
|
||||
self.assertIn(('X-AlbumImage', 'image2;image1'), result)
|
||||
self.assertNotIn(('Comment', 'a comment'), result)
|
||||
self.assertEqual(len(result), 14)
|
||||
self.assertEqual(len(result), 16)
|
||||
|
||||
def test_track_to_mpd_format_with_last_modified(self):
|
||||
track = self.track.replace(last_modified=995303899000)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user