mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Fix KeyError on 'title' when title is empty
This commit is contained in:
parent
586be7fad1
commit
6e2fb17f19
@ -142,12 +142,15 @@ 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:
|
||||
return '{}: {}'.format(name, title)
|
||||
if title is None:
|
||||
return name
|
||||
else:
|
||||
return '{}: {}'.format(name, title)
|
||||
|
||||
@property
|
||||
def media_artist(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user