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 <losinski@wh2.tu-dresden.de>
This commit is contained in:
Jan Losinski 2016-12-01 21:20:42 +01:00 committed by Paulus Schoutsen
parent 6dfae7a259
commit dd84b4e237

View File

@ -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):