mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
MPD now uses the filename if song doesn't have metadata (#10085)
* added support for filename * used the getter instead - minor mistake * changed how the filename is generated
This commit is contained in:
parent
f17cf1d26b
commit
85d7377beb
@ -5,6 +5,7 @@ For more details about this platform, please refer to the documentation at
|
|||||||
https://home-assistant.io/components/media_player.mpd/
|
https://home-assistant.io/components/media_player.mpd/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -176,9 +177,13 @@ class MpdDevice(MediaPlayerDevice):
|
|||||||
"""Return the title of current playing media."""
|
"""Return the title of current playing media."""
|
||||||
name = self._currentsong.get('name', None)
|
name = self._currentsong.get('name', None)
|
||||||
title = self._currentsong.get('title', None)
|
title = self._currentsong.get('title', None)
|
||||||
|
file_name = self._currentsong.get('file', None)
|
||||||
|
|
||||||
if name is None and title is None:
|
if name is None and title is None:
|
||||||
return "None"
|
if file_name is None:
|
||||||
|
return "None"
|
||||||
|
else:
|
||||||
|
return os.path.basename(file_name)
|
||||||
elif name is None:
|
elif name is None:
|
||||||
return title
|
return title
|
||||||
elif title is None:
|
elif title is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user