mirror of
https://github.com/beetbox/beets.git
synced 2025-12-27 11:02:43 +01:00
Merge pull request #3825 from agsimmons/fix-mpd2-warning-py2
Add Python version check for mpdstats
This commit is contained in:
commit
6a4c94120c
2 changed files with 10 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue