[Players - mpd] Use Unicode where available

Otherwise the mpd function will fail when it encounters non-ASCII
metadata as it tries to do a unicode.format() and attempts to decode
the incoming data as ASCII, throwing a UnicodeDecodeError exception.

Fixes #1500
This commit is contained in:
Mook 2015-11-28 11:28:51 -08:00
parent eaa772f195
commit 4265da2e1d
1 changed files with 5 additions and 1 deletions

View File

@ -189,6 +189,10 @@ class MpdPlayerSegment(PlayerSegment):
'total': now_playing[3],
}
else:
try:
client = mpd.MPDClient(use_unicode=True)
except TypeError:
# python-mpd 1.x does not support use_unicode
client = mpd.MPDClient()
client.connect(host, port)
if password: