Merge branch 'fatg3erman-fix/1212-mpd-stream-name-title-reversed' into develop
This commit is contained in:
commit
8e8577f707
@ -38,12 +38,15 @@ def track_to_mpd_format(track, position=None, stream_title=None):
|
||||
# https://github.com/mopidy/mopidy/issues/923#issuecomment-79584110
|
||||
('Time', track.length and (track.length // 1000) or 0),
|
||||
('Artist', concat_multi_values(track.artists, 'name')),
|
||||
('Title', track.name or ''),
|
||||
('Album', track.album and track.album.name or ''),
|
||||
]
|
||||
|
||||
if stream_title:
|
||||
result.append(('Name', stream_title))
|
||||
if stream_title is not None:
|
||||
result.append(('Title', stream_title))
|
||||
if track.name:
|
||||
result.append(('Name', track.name))
|
||||
else:
|
||||
result.append(('Title', track.name or ''))
|
||||
|
||||
if track.date:
|
||||
result.append(('Date', track.date))
|
||||
|
||||
@ -118,6 +118,22 @@ class TrackMpdFormatTest(unittest.TestCase):
|
||||
translated = translator.concat_multi_values(artists, 'musicbrainz_id')
|
||||
self.assertEqual(translated, '')
|
||||
|
||||
def test_track_to_mpd_format_with_stream_title(self):
|
||||
result = translator.track_to_mpd_format(self.track, stream_title='foo')
|
||||
self.assertIn(('Name', 'a name'), result)
|
||||
self.assertIn(('Title', 'foo'), result)
|
||||
|
||||
def test_track_to_mpd_format_with_empty_stream_title(self):
|
||||
result = translator.track_to_mpd_format(self.track, stream_title='')
|
||||
self.assertIn(('Name', 'a name'), result)
|
||||
self.assertIn(('Title', ''), result)
|
||||
|
||||
def test_track_to_mpd_format_with_stream_and_no_track_name(self):
|
||||
track = self.track.replace(name=None)
|
||||
result = translator.track_to_mpd_format(track, stream_title='foo')
|
||||
self.assertNotIn(('Name', ''), result)
|
||||
self.assertIn(('Title', 'foo'), result)
|
||||
|
||||
|
||||
class PlaylistMpdFormatTest(unittest.TestCase):
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user