core: Update title distinct name to track

This commit is contained in:
Thomas Adamcik 2015-05-20 23:14:46 +02:00
parent 31509ea568
commit 2b3e976bc9
4 changed files with 8 additions and 3 deletions

View File

@ -85,7 +85,7 @@ class LibraryController(object):
protocol supports in a more sane fashion. Other frontends are not
recommended to use this method.
:param string field: One of ``title``, ``artist``, ``albumartist``,
:param string field: One of ``track``, ``artist``, ``albumartist``,
``album``, ``composer``, ``performer``, ``date``or ``genre``.
:param dict query: Query to use for limiting results, see
:meth:`search` for details about the query format.

View File

@ -141,7 +141,7 @@ class JsonLibrary(local.Library):
return []
def get_distinct(self, field, query=None):
if field == 'title':
if field == 'track':
def distinct(track):
return {track.name}
elif field == 'artist':

View File

@ -22,7 +22,7 @@ _SEARCH_MAPPING = {
'track': 'track_no'}
_LIST_MAPPING = {
'title': 'title',
'title': 'track',
'album': 'album',
'albumartist': 'albumartist',
'artist': 'artist',

View File

@ -624,6 +624,11 @@ class MusicDatabaseListTest(protocol.BaseTestCase):
self.send_request('list "foo"')
self.assertEqualResponse('ACK [2@0] {list} incorrect arguments')
# Track title
def test_list_title(self):
self.send_request('list "title"')
self.assertInResponse('OK')
# Artist
def test_list_artist_with_quotes(self):