mpd: Fix swapped Name and Title fields for streams

Fixes issue#1212

When stream_title is set:
use stream_title for mpd's Title field, and use track.name (if set) for mpd's Name field

When stream_title is not set:
use track.name for mpd's Title field. Do not output Name field.

Conflicts:
	mopidy/mpd/translator.py
This commit is contained in:
Mark Greenwood 2015-07-08 22:06:19 +01:00 committed by Thomas Adamcik
parent 2f3d1b3f60
commit 0c9542c3d6

View File

@ -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', artists_to_mpd_format(track.artists)),
('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))