Merge pull request #884 from tkem/feature/mpd-browse-all-ref-types
Make everything that is not a Track browseable via MPD
This commit is contained in:
commit
5fd00b4e7d
@ -299,8 +299,7 @@ class MpdContext(object):
|
||||
uri = None
|
||||
for part in path_parts:
|
||||
for ref in self.core.library.browse(uri).get():
|
||||
if (ref.type in (ref.DIRECTORY, ref.ALBUM, ref.PLAYLIST)
|
||||
and ref.name == part):
|
||||
if ref.type != ref.TRACK and ref.name == part:
|
||||
uri = ref.uri
|
||||
break
|
||||
else:
|
||||
@ -320,13 +319,13 @@ class MpdContext(object):
|
||||
path = '/'.join([base_path, ref.name.replace('/', '')])
|
||||
path = self.insert_name_uri_mapping(path, ref.uri)
|
||||
|
||||
if ref.type in (ref.DIRECTORY, ref.ALBUM, ref.PLAYLIST):
|
||||
yield (path, None)
|
||||
if recursive:
|
||||
path_and_futures.append(
|
||||
(path, self.core.library.browse(ref.uri)))
|
||||
elif ref.type == ref.TRACK:
|
||||
if ref.type == ref.TRACK:
|
||||
if lookup:
|
||||
yield (path, self.core.library.lookup(ref.uri))
|
||||
else:
|
||||
yield (path, ref)
|
||||
else:
|
||||
yield (path, None)
|
||||
if recursive:
|
||||
path_and_futures.append(
|
||||
(path, self.core.library.browse(ref.uri)))
|
||||
|
||||
@ -139,6 +139,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
|
||||
'dummy:/': [Ref.track(uri='dummy:/a', name='a'),
|
||||
Ref.directory(uri='dummy:/foo', name='foo'),
|
||||
Ref.album(uri='dummy:/album', name='album'),
|
||||
Ref.artist(uri='dummy:/artist', name='artist'),
|
||||
Ref.playlist(uri='dummy:/pl', name='pl')],
|
||||
'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]}
|
||||
|
||||
@ -147,6 +148,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
|
||||
self.assertInResponse('file: dummy:/a')
|
||||
self.assertInResponse('directory: /dummy/foo')
|
||||
self.assertInResponse('directory: /dummy/album')
|
||||
self.assertInResponse('directory: /dummy/artist')
|
||||
self.assertInResponse('directory: /dummy/pl')
|
||||
self.assertInResponse('file: dummy:/foo/b')
|
||||
self.assertInResponse('OK')
|
||||
@ -207,6 +209,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
|
||||
'dummy:/': [Ref.track(uri='dummy:/a', name='a'),
|
||||
Ref.directory(uri='dummy:/foo', name='foo'),
|
||||
Ref.album(uri='dummy:/album', name='album'),
|
||||
Ref.artist(uri='dummy:/artist', name='artist'),
|
||||
Ref.playlist(uri='dummy:/pl', name='pl')],
|
||||
'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]}
|
||||
|
||||
@ -216,6 +219,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
|
||||
self.assertInResponse('Title: a')
|
||||
self.assertInResponse('directory: /dummy/foo')
|
||||
self.assertInResponse('directory: /dummy/album')
|
||||
self.assertInResponse('directory: /dummy/artist')
|
||||
self.assertInResponse('directory: /dummy/pl')
|
||||
self.assertInResponse('file: dummy:/foo/b')
|
||||
self.assertInResponse('Title: b')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user