diff --git a/mopidy/frontends/mpd/dispatcher.py b/mopidy/frontends/mpd/dispatcher.py index d269786e..0054a6f1 100644 --- a/mopidy/frontends/mpd/dispatcher.py +++ b/mopidy/frontends/mpd/dispatcher.py @@ -232,9 +232,9 @@ class MpdContext(object): #: The subsytems that we want to be notified about in idle mode. subscriptions = None - _playlist_uri_from_name = None + playlist_uri_from_name = None - _playlist_name_from_uri = None + playlist_name_from_uri = None def __init__(self, dispatcher, session=None, core=None): self.dispatcher = dispatcher @@ -242,14 +242,14 @@ class MpdContext(object): self.core = core self.events = set() self.subscriptions = set() - self._playlist_uri_from_name = {} - self._playlist_name_from_uri = {} + self.playlist_uri_from_name = {} + self.playlist_name_from_uri = {} self.refresh_playlists_mapping() def create_unique_name(self, playlist_name): name = playlist_name i = 1 - while name in self._playlist_uri_from_name: + while name in self.playlist_uri_from_name: name = '%s [%d]' % (playlist_name, i) i += 1 return name @@ -260,11 +260,11 @@ class MpdContext(object): MPD """ if self.core is not None: - self._playlist_uri_from_name.clear() - self._playlist_name_from_uri.clear() + self.playlist_uri_from_name.clear() + self.playlist_name_from_uri.clear() for playlist in self.core.playlists.playlists.get(): if not playlist.name: continue name = self.create_unique_name(playlist.name) - self._playlist_uri_from_name[name] = playlist.uri - self._playlist_name_from_uri[playlist.uri] = name + self.playlist_uri_from_name[name] = playlist.uri + self.playlist_name_from_uri[playlist.uri] = name diff --git a/mopidy/frontends/mpd/protocol/music_db.py b/mopidy/frontends/mpd/protocol/music_db.py index ac7c860a..11def309 100644 --- a/mopidy/frontends/mpd/protocol/music_db.py +++ b/mopidy/frontends/mpd/protocol/music_db.py @@ -381,11 +381,11 @@ def searchaddpl(context, playlist_name, mpd_query): return results = context.core.library.search(**query).get() - if len(context._playlist_uri_from_name) == 0: + if len(context.playlist_uri_from_name) == 0: context.refresh_playlists_mapping() - if playlist_name in context._playlist_uri_from_name: - uri = context._playlist_uri_from_name[playlist_name] + if playlist_name in context.playlist_uri_from_name: + uri = context.playlist_uri_from_name[playlist_name] playlist = context.core.playlists.lookup(uri).get() else: playlist = context.core.playlists.create(playlist_name).get() diff --git a/mopidy/frontends/mpd/protocol/stored_playlists.py b/mopidy/frontends/mpd/protocol/stored_playlists.py index a01e2775..b9fbad06 100644 --- a/mopidy/frontends/mpd/protocol/stored_playlists.py +++ b/mopidy/frontends/mpd/protocol/stored_playlists.py @@ -80,10 +80,10 @@ def listplaylists(context): for playlist in context.core.playlists.playlists.get(): if not playlist.name: continue - if playlist.uri not in context._playlist_name_from_uri: + if playlist.uri not in context.playlist_name_from_uri: # the maps are not synced, we refresh them context.refresh_playlists_mapping() - name = context._playlist_name_from_uri[playlist.uri] + name = context.playlist_name_from_uri[playlist.uri] result.append(('playlist', name)) last_modified = ( playlist.last_modified or dt.datetime.utcnow()).isoformat()