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
|
uri = None
|
||||||
for part in path_parts:
|
for part in path_parts:
|
||||||
for ref in self.core.library.browse(uri).get():
|
for ref in self.core.library.browse(uri).get():
|
||||||
if (ref.type in (ref.DIRECTORY, ref.ALBUM, ref.PLAYLIST)
|
if ref.type != ref.TRACK and ref.name == part:
|
||||||
and ref.name == part):
|
|
||||||
uri = ref.uri
|
uri = ref.uri
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@ -320,13 +319,13 @@ class MpdContext(object):
|
|||||||
path = '/'.join([base_path, ref.name.replace('/', '')])
|
path = '/'.join([base_path, ref.name.replace('/', '')])
|
||||||
path = self.insert_name_uri_mapping(path, ref.uri)
|
path = self.insert_name_uri_mapping(path, ref.uri)
|
||||||
|
|
||||||
if ref.type in (ref.DIRECTORY, ref.ALBUM, ref.PLAYLIST):
|
if ref.type == ref.TRACK:
|
||||||
yield (path, None)
|
|
||||||
if recursive:
|
|
||||||
path_and_futures.append(
|
|
||||||
(path, self.core.library.browse(ref.uri)))
|
|
||||||
elif ref.type == ref.TRACK:
|
|
||||||
if lookup:
|
if lookup:
|
||||||
yield (path, self.core.library.lookup(ref.uri))
|
yield (path, self.core.library.lookup(ref.uri))
|
||||||
else:
|
else:
|
||||||
yield (path, ref)
|
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'),
|
'dummy:/': [Ref.track(uri='dummy:/a', name='a'),
|
||||||
Ref.directory(uri='dummy:/foo', name='foo'),
|
Ref.directory(uri='dummy:/foo', name='foo'),
|
||||||
Ref.album(uri='dummy:/album', name='album'),
|
Ref.album(uri='dummy:/album', name='album'),
|
||||||
|
Ref.artist(uri='dummy:/artist', name='artist'),
|
||||||
Ref.playlist(uri='dummy:/pl', name='pl')],
|
Ref.playlist(uri='dummy:/pl', name='pl')],
|
||||||
'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]}
|
'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('file: dummy:/a')
|
||||||
self.assertInResponse('directory: /dummy/foo')
|
self.assertInResponse('directory: /dummy/foo')
|
||||||
self.assertInResponse('directory: /dummy/album')
|
self.assertInResponse('directory: /dummy/album')
|
||||||
|
self.assertInResponse('directory: /dummy/artist')
|
||||||
self.assertInResponse('directory: /dummy/pl')
|
self.assertInResponse('directory: /dummy/pl')
|
||||||
self.assertInResponse('file: dummy:/foo/b')
|
self.assertInResponse('file: dummy:/foo/b')
|
||||||
self.assertInResponse('OK')
|
self.assertInResponse('OK')
|
||||||
@ -207,6 +209,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
|
|||||||
'dummy:/': [Ref.track(uri='dummy:/a', name='a'),
|
'dummy:/': [Ref.track(uri='dummy:/a', name='a'),
|
||||||
Ref.directory(uri='dummy:/foo', name='foo'),
|
Ref.directory(uri='dummy:/foo', name='foo'),
|
||||||
Ref.album(uri='dummy:/album', name='album'),
|
Ref.album(uri='dummy:/album', name='album'),
|
||||||
|
Ref.artist(uri='dummy:/artist', name='artist'),
|
||||||
Ref.playlist(uri='dummy:/pl', name='pl')],
|
Ref.playlist(uri='dummy:/pl', name='pl')],
|
||||||
'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]}
|
'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]}
|
||||||
|
|
||||||
@ -216,6 +219,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
|
|||||||
self.assertInResponse('Title: a')
|
self.assertInResponse('Title: a')
|
||||||
self.assertInResponse('directory: /dummy/foo')
|
self.assertInResponse('directory: /dummy/foo')
|
||||||
self.assertInResponse('directory: /dummy/album')
|
self.assertInResponse('directory: /dummy/album')
|
||||||
|
self.assertInResponse('directory: /dummy/artist')
|
||||||
self.assertInResponse('directory: /dummy/pl')
|
self.assertInResponse('directory: /dummy/pl')
|
||||||
self.assertInResponse('file: dummy:/foo/b')
|
self.assertInResponse('file: dummy:/foo/b')
|
||||||
self.assertInResponse('Title: b')
|
self.assertInResponse('Title: b')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user