From 33e3fe9173e075e9664da54fe641fe0e736e15a1 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 13 Dec 2014 01:26:36 +0100 Subject: [PATCH] mpd: Add browse() helper docs --- mopidy/mpd/dispatcher.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mopidy/mpd/dispatcher.py b/mopidy/mpd/dispatcher.py index 52b57258..5d9cecd9 100644 --- a/mopidy/mpd/dispatcher.py +++ b/mopidy/mpd/dispatcher.py @@ -292,6 +292,24 @@ class MpdContext(object): return self._name_from_uri[uri] def browse(self, path, recursive=True, lookup=True): + """ + Browse the contents of a given directory path. + + Returns a sequence of two-tuples ``(path, data)``. + + If ``recursive`` is true, it returns results for all entries in the + given path. + + If ``lookup`` is true and the ``path`` is to a track, the returned + ``data`` is a future which will contain the + :class:`mopidy.models.Track` model. If ``lookup`` is false and the + ``path`` is to a track, the returned ``data`` will be a + :class:`mopidy.models.Ref` for the track. + + For all entries that are not tracks, the returned ``data`` will be + :class:`None`. + """ + path_parts = re.findall(r'[^/]+', path or '') root_path = '/'.join([''] + path_parts)