From dd84b4e237f00129e04f1f78aa6ebb1b556ab943 Mon Sep 17 00:00:00 2001 From: Jan Losinski Date: Thu, 1 Dec 2016 21:20:42 +0100 Subject: [PATCH] Mpd: Use "file" instead "id" for media_content_id (#4653) In media_content_id() the "id" of the current song was returned. as stated in bug #4652 the id is only the Tracklist-Id in the current tracklist and is omitted if the track is not part of a tracklist (what caused the bug in the first place). To match the semantics described in the dockstring, to return a "Content ID", this chooses the filename of the current song as id and returns it. It also uses get() instead of [] to prevent KeyError. This fixes bug #4652 Signed-off-by: Jan Losinski --- homeassistant/components/media_player/mpd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/media_player/mpd.py b/homeassistant/components/media_player/mpd.py index 9967a26a3a0..083b1108f92 100644 --- a/homeassistant/components/media_player/mpd.py +++ b/homeassistant/components/media_player/mpd.py @@ -133,7 +133,7 @@ class MpdDevice(MediaPlayerDevice): @property def media_content_id(self): """Content ID of current playing media.""" - return self.currentsong['id'] + return self.currentsong.get('file') @property def media_content_type(self):