From f2000d6e6df362fa9c07379a483d91cf2b67ce88 Mon Sep 17 00:00:00 2001 From: Thomas Refis Date: Tue, 9 Apr 2013 21:31:36 +0200 Subject: [PATCH] mpd: 'private' fields start with an _ --- mopidy/frontends/mpd/dispatcher.py | 18 +++++++++--------- mopidy/frontends/mpd/protocol/music_db.py | 6 +++--- .../frontends/mpd/protocol/stored_playlists.py | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mopidy/frontends/mpd/dispatcher.py b/mopidy/frontends/mpd/dispatcher.py index 0054a6f1..d269786e 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 11def309..ac7c860a 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 b9fbad06..a01e2775 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()