diff --git a/mopidy/mpd/handler.py b/mopidy/mpd/handler.py index 83ce9937..640b6453 100644 --- a/mopidy/mpd/handler.py +++ b/mopidy/mpd/handler.py @@ -345,7 +345,10 @@ class MpdHandler(object): Finds songs in the db that are exactly ``WHAT``. ``TYPE`` should be ``album``, ``artist``, or ``title``. ``WHAT`` is what to find. """ - raise MpdNotImplemented # TODO + if type == u'title': + type = u'track' + return self.backend.library.find_exact(type, what).mpd_format( + search_result=True) @handle_pattern(r'^findadd "(?P(album|artist|title))" "(?P[^"]+)"$') def _findadd(self, type, what): @@ -971,6 +974,8 @@ class MpdHandler(object): ``title``, ``artist``, ``album`` or ``filename``. Search is not case sensitive. """ + if type == u'title': + type = u'track' return self.backend.library.search(type, what).mpd_format( search_result=True) diff --git a/tests/mpd/handlertest.py b/tests/mpd/handlertest.py index f608d26a..4f20d7a4 100644 --- a/tests/mpd/handlertest.py +++ b/tests/mpd/handlertest.py @@ -674,7 +674,8 @@ class StoredPlaylistsHandlerTest(unittest.TestCase): class MusicDatabaseHandlerTest(unittest.TestCase): def setUp(self): - self.h = handler.MpdHandler(backend=DummyBackend()) + self.b = DummyBackend() + self.h = handler.MpdHandler(backend=self.b) def test_count(self): result = self.h.handle_request(u'count "tag" "needle"') @@ -682,15 +683,15 @@ class MusicDatabaseHandlerTest(unittest.TestCase): def test_find_album(self): result = self.h.handle_request(u'find "album" "what"') - self.assert_(u'ACK Not implemented' in result) + self.assert_(u'OK' in result) def test_find_artist(self): result = self.h.handle_request(u'find "artist" "what"') - self.assert_(u'ACK Not implemented' in result) + self.assert_(u'OK' in result) def test_find_title(self): result = self.h.handle_request(u'find "title" "what"') - self.assert_(u'ACK Not implemented' in result) + self.assert_(u'OK' in result) def test_find_else_should_fail(self): try: @@ -701,7 +702,7 @@ class MusicDatabaseHandlerTest(unittest.TestCase): def test_findadd(self): result = self.h.handle_request(u'findadd "album" "what"') - self.assert_(u'ACK Not implemented' in result) + self.assert_(u'OK' in result) def test_list_artist(self): result = self.h.handle_request(u'list "artist"')