Fix KeyError on 'title' when title is empty

This commit is contained in:
Richard Arends 2015-12-29 17:52:05 +01:00
parent 586be7fad1
commit 6e2fb17f19

View file

@ -142,10 +142,13 @@ class MpdDevice(MediaPlayerDevice):
def media_title(self):
""" Title of current playing media. """
name = self.currentsong.get('name', None)
title = self.currentsong['title']
title = self.currentsong.get('title', None)
if name is None:
return title
else:
if title is None:
return name
else:
return '{}: {}'.format(name, title)