From 70cfc0b33a2585208648e518c2debf3ad58ee216 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sun, 26 Jul 2015 12:12:15 +0200 Subject: [PATCH] mpd: PR #1235 tweaks, add changelog --- docs/changelog.rst | 5 +++++ mopidy/mpd/translator.py | 13 ++++--------- tests/mpd/protocol/test_reflection.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 320c776a..8637ac1f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -80,6 +80,11 @@ MPD frontend - Track data now include the ``Last-Modified`` field if set on the track model. (Fixes: :issue:`1218`, PR: :issue:`1219`) +- Implement ``tagtypes`` MPD command. (PR: :issue:`1235`) + +- Exclude empty tags fields from metadata output. (Fixes: :issue:`1045`, PR: + :issue:`1235`) + Local backend ------------- diff --git a/mopidy/mpd/translator.py b/mopidy/mpd/translator.py index 2f3efd1d..ef16ed28 100644 --- a/mopidy/mpd/translator.py +++ b/mopidy/mpd/translator.py @@ -97,7 +97,6 @@ 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)) - # clean up result result = [element for element in result if _has_value(*element)] return result @@ -105,19 +104,15 @@ def track_to_mpd_format(track, position=None, stream_title=None): def _has_value(tagtype, value): """ - Determine whether to add the tagtype - to the output or not (if they have a default value). + Determine whether to add the tagtype to the output or not. - :param tagtype: the mpd tagtype + :param tagtype: the MPD tagtype :type tagtype: string - :param value: the associated value - :type value: multiple + :param value: the tag value :rtype: bool """ if tagtype in tagtype_list.TAGTYPE_LIST: - if not value: - return False - + return bool(value) return True diff --git a/tests/mpd/protocol/test_reflection.py b/tests/mpd/protocol/test_reflection.py index 0745479d..097c2e2a 100644 --- a/tests/mpd/protocol/test_reflection.py +++ b/tests/mpd/protocol/test_reflection.py @@ -41,7 +41,6 @@ class ReflectionHandlerTest(protocol.BaseTestCase): def test_tagtypes(self): self.send_request('tagtypes') - self.assertInResponse('OK') self.assertInResponse('tagtype: Artist') self.assertInResponse('tagtype: ArtistSort') self.assertInResponse('tagtype: Album') @@ -59,6 +58,7 @@ class ReflectionHandlerTest(protocol.BaseTestCase): self.assertInResponse('tagtype: MUSICBRAINZ_ALBUMID') self.assertInResponse('tagtype: MUSICBRAINZ_ALBUMARTISTID') self.assertInResponse('tagtype: MUSICBRAINZ_TRACKID') + self.assertInResponse('OK') def test_urlhandlers(self): self.send_request('urlhandlers')