mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Expect the case where currentsong['name'] can be absent. Use the .get
funtion with a default value set to None
This commit is contained in:
parent
85b62a20c8
commit
035d518cb6
@ -141,13 +141,13 @@ class MpdDevice(MediaPlayerDevice):
|
||||
@property
|
||||
def media_title(self):
|
||||
""" Title of current playing media. """
|
||||
name = self.currentsong['name']
|
||||
name = self.currentsong.get('name', None)
|
||||
title = self.currentsong['title']
|
||||
|
||||
if name:
|
||||
return '{}: {}'.format(name, title)
|
||||
else:
|
||||
if name is None:
|
||||
return title
|
||||
else:
|
||||
return '{}: {}'.format(name, title)
|
||||
|
||||
@property
|
||||
def media_artist(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user