diff --git a/beetsplug/mpdstats.py b/beetsplug/mpdstats.py index 39b045f9b..599aa7631 100644 --- a/beetsplug/mpdstats.py +++ b/beetsplug/mpdstats.py @@ -18,6 +18,7 @@ from __future__ import division, absolute_import, print_function import mpd import socket import select +import sys import time import os @@ -52,7 +53,13 @@ class MPDClientWrapper(object): self.music_directory = ( mpd_config['music_directory'].as_str()) - self.client = mpd.MPDClient(use_unicode=True) + if sys.version_info < (3, 0): + # On Python 2, use_unicode will enable the utf-8 mode for + # python-mpd2 + self.client = mpd.MPDClient(use_unicode=True) + else: + # On Python 3, python-mpd2 always uses Unicode + self.client = mpd.MPDClient() def connect(self): """Connect to the MPD. diff --git a/docs/changelog.rst b/docs/changelog.rst index ce445496e..dd8e08ca2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -293,6 +293,8 @@ Fixes: :bug:`2242` * :doc:`plugins/replaygain`: Disable parallel analysis on import by default. :bug:`3819` +* :doc:`/plugins/mpdstats`: Fix Python 2/3 compatibility + :bug:`3798` For plugin developers: