Merge pull request #755 from trygveaa/feature/lsinfo-change-order
mpd: List browse results before playlists in lsinfo
This commit is contained in:
commit
9b9791ab5b
@ -410,9 +410,6 @@ def lsinfo(context, uri=None):
|
||||
""``, and ``lsinfo "/"``.
|
||||
"""
|
||||
result = []
|
||||
if uri in (None, '', '/'):
|
||||
result.extend(protocol.stored_playlists.listplaylists(context))
|
||||
|
||||
for path, lookup_future in context.browse(uri, recursive=False):
|
||||
if not lookup_future:
|
||||
result.append(('directory', path.lstrip('/')))
|
||||
@ -421,6 +418,9 @@ def lsinfo(context, uri=None):
|
||||
if tracks:
|
||||
result.extend(translator.track_to_mpd_format(tracks[0]))
|
||||
|
||||
if uri in (None, '', '/'):
|
||||
result.extend(protocol.stored_playlists.listplaylists(context))
|
||||
|
||||
if not result:
|
||||
raise exceptions.MpdNoExistError('Not found')
|
||||
return result
|
||||
|
||||
@ -350,6 +350,18 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
|
||||
self.assertNotInResponse('directory: dummy')
|
||||
self.assertInResponse('OK')
|
||||
|
||||
def test_lsinfo_for_root_returns_browse_result_before_playlists(self):
|
||||
last_modified = 1390942873222
|
||||
self.backend.library.dummy_browse_result = {
|
||||
'dummy:/': [Ref.track(uri='dummy:/a', name='a'),
|
||||
Ref.directory(uri='dummy:/foo', name='foo')]}
|
||||
self.backend.playlists.playlists = [
|
||||
Playlist(name='a', uri='dummy:/a', last_modified=last_modified)]
|
||||
|
||||
response = self.sendRequest('lsinfo "/"')
|
||||
self.assertLess(response.index('directory: dummy'),
|
||||
response.index('playlist: a'))
|
||||
|
||||
def test_update_without_uri(self):
|
||||
self.sendRequest('update')
|
||||
self.assertInResponse('updating_db: 0')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user