mpd: Allow 'count' without quotes around the 'tag' param
Fix hechtus/mopidy-gmusic#1
This commit is contained in:
parent
0a61b4642e
commit
99eed0e6b8
@ -39,7 +39,7 @@ def _artist_as_track(artist):
|
||||
artists=[artist])
|
||||
|
||||
|
||||
@handle_request(r'^count "(?P<tag>[^"]+)" "(?P<needle>[^"]*)"$')
|
||||
@handle_request(r'^count "?(?P<tag>[^"]+)"? "(?P<needle>[^"]*)"$')
|
||||
def count(context, tag, needle):
|
||||
"""
|
||||
*musicpd.org, music database section:*
|
||||
@ -48,6 +48,10 @@ def count(context, tag, needle):
|
||||
|
||||
Counts the number of songs and their total playtime in the db
|
||||
matching ``TAG`` exactly.
|
||||
|
||||
*GMPC:*
|
||||
|
||||
- does not add quotes around the tag argument.
|
||||
"""
|
||||
return [('songs', 0), ('playtime', 0)] # TODO
|
||||
|
||||
|
||||
@ -12,6 +12,12 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase):
|
||||
self.assertInResponse('playtime: 0')
|
||||
self.assertInResponse('OK')
|
||||
|
||||
def test_count_without_quotes(self):
|
||||
self.sendRequest('count tag "needle"')
|
||||
self.assertInResponse('songs: 0')
|
||||
self.assertInResponse('playtime: 0')
|
||||
self.assertInResponse('OK')
|
||||
|
||||
def test_findadd(self):
|
||||
self.backend.library.dummy_find_exact_result = SearchResult(
|
||||
tracks=[Track(uri='dummy:a', name='A')])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user