core/mpd/local: Add title to get_distinct field types
This commit is contained in:
parent
2ae56ed8a6
commit
31509ea568
@ -5,6 +5,14 @@ Changelog
|
||||
This changelog is used to track all major changes to Mopidy.
|
||||
|
||||
|
||||
v1.0.6 (unreleased)
|
||||
===================
|
||||
|
||||
Bug fix release.
|
||||
|
||||
- Core/MPD/Local: Add support for ``title`` in
|
||||
:meth:`mopidy.core.LibraryController.get_distinct`. (Fixes: :issue:`1181`)
|
||||
|
||||
v1.0.5 (2015-05-19)
|
||||
===================
|
||||
|
||||
|
||||
@ -97,6 +97,9 @@ class LibraryProvider(object):
|
||||
*MAY be implemented by subclass.*
|
||||
|
||||
Default implementation will simply return an empty set.
|
||||
|
||||
Note that backends should always return an empty set for unexpected
|
||||
field types.
|
||||
"""
|
||||
return set()
|
||||
|
||||
|
||||
@ -85,8 +85,8 @@ class LibraryController(object):
|
||||
protocol supports in a more sane fashion. Other frontends are not
|
||||
recommended to use this method.
|
||||
|
||||
:param string field: One of ``artist``, ``albumartist``, ``album``,
|
||||
``composer``, ``performer``, ``date``or ``genre``.
|
||||
:param string field: One of ``title``, ``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.
|
||||
:rtype: set of values corresponding to the requested field type.
|
||||
|
||||
@ -141,7 +141,10 @@ class JsonLibrary(local.Library):
|
||||
return []
|
||||
|
||||
def get_distinct(self, field, query=None):
|
||||
if field == 'artist':
|
||||
if field == 'title':
|
||||
def distinct(track):
|
||||
return {track.name}
|
||||
elif field == 'artist':
|
||||
def distinct(track):
|
||||
return {a.name for a in track.artists}
|
||||
elif field == 'albumartist':
|
||||
|
||||
@ -22,6 +22,7 @@ _SEARCH_MAPPING = {
|
||||
'track': 'track_no'}
|
||||
|
||||
_LIST_MAPPING = {
|
||||
'title': 'title',
|
||||
'album': 'album',
|
||||
'albumartist': 'albumartist',
|
||||
'artist': 'artist',
|
||||
@ -31,6 +32,7 @@ _LIST_MAPPING = {
|
||||
'performer': 'performer'}
|
||||
|
||||
_LIST_NAME_MAPPING = {
|
||||
'title': 'Title',
|
||||
'album': 'Album',
|
||||
'albumartist': 'AlbumArtist',
|
||||
'artist': 'Artist',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user