mpd: Enable browsing of empty dirs

This was disabled together with a bunch of other changes without any
explanation in commit f24ca36e5a. I'm
guessing that this wasn't intentional, and no test covered the case.

(cherry picked from commit 4e508cd017)
This commit is contained in:
Stein Magnus Jodal 2014-12-13 01:26:41 +01:00
parent a00bfb7fa1
commit 6e55435aa9
2 changed files with 7 additions and 2 deletions

View File

@ -421,8 +421,6 @@ def lsinfo(context, uri=None):
if uri in (None, '', '/'):
result.extend(protocol.stored_playlists.listplaylists(context))
if not result:
raise exceptions.MpdNoExistError('Not found')
return result

View File

@ -347,6 +347,13 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
self.assertInResponse('directory: dummy/foo')
self.assertInResponse('OK')
def test_lsinfo_for_empty_dir_returns_nothing(self):
self.backend.library.dummy_browse_result = {
'dummy:/': []}
self.sendRequest('lsinfo "/dummy"')
self.assertInResponse('OK')
def test_lsinfo_for_dir_does_not_recurse(self):
self.backend.library.dummy_library = [
Track(uri='dummy:/a', name='a'),