diff --git a/beetsplug/discogs.py b/beetsplug/discogs.py index 3b2595585..b1b1593cd 100644 --- a/beetsplug/discogs.py +++ b/beetsplug/discogs.py @@ -505,6 +505,12 @@ class DiscogsPlugin(BeetsPlugin): for subtrack in subtracks: if not subtrack.get('artists'): subtrack['artists'] = index_track['artists'] + # Concatenate index with track title when index_tracks + # option is set + if self.config['index_tracks']: + for subtrack in subtracks: + subtrack['title'] = '{}: {}'.format( + index_track['title'], subtrack['title']) tracklist.extend(subtracks) else: # Merge the subtracks, pick a title, and append the new track. @@ -557,7 +563,8 @@ class DiscogsPlugin(BeetsPlugin): title = track['title'] if self.config['index_tracks']: prefix = ', '.join(divisions) - title = ': '.join([prefix, title]) + if prefix: + title = '{}: {}'.format(prefix, title) track_id = None medium, medium_index, _ = self.get_track_index(track['position']) artist, artist_id = MetadataSourcePlugin.get_artist( 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 fbe449ca4..0fb503f80 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -176,6 +176,9 @@ New features: Fixes: +* :bug:`/plugins/discogs`: Fixed a bug with ``index_tracks`` options that + sometimes caused the index to be discarded. Also remove the extra semicolon + that was added when there is no index track. * :doc:`/plugins/subsonicupdate`: REST was using `POST` method rather `GET` method. Also includes better exception handling, response parsing, and tests. * :doc:`/plugins/the`: Fixed incorrect regex for 'the' that matched any @@ -290,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` * Fix :bug:`3308` by using browsing for big releases to retrieve additional information. Thanks to :user:`dosoe`.