mopidy / mopidy-local

Mopidy extension for playing music from your local music archive
https://mopidy.com/ext/local/
Apache License 2.0
61 stars 26 forks source link

get_distinct does not support field 'track' #44

Closed kingosticks closed 4 years ago

kingosticks commented 4 years ago

The current implementation of get_distinct handles field value 'track_name' rather than 'track', the latter of which is what Mopidy 3.x and below use.

https://github.com/mopidy/mopidy/pull/1900 aims to fix this so that 'track_name' will be used, but until that breaking API change is released (next major version?), 'track' will continue to be used and Mopidy-Local needs to support this. When testing Mopidy-Local with https://github.com/mopidy/mopidy/pull/1900, sending mpc list title produces the following error:

Core-7 ERROR    2020-05-17 15:48:36,363 LocalBackend backend caused an exception.
Traceback (most recent call last):
  File "/home/nick/Dev/mopidy-dev/mopidy/mopidy/core/library.py", line 17, in _backend_error_handling
    yield
  File "/home/nick/Dev/mopidy-dev/mopidy/mopidy/core/library.py", line 155, in get_distinct
    values = future.get()
  File "/usr/lib/python3/dist-packages/pykka/_threading.py", line 45, in get
    _compat.reraise(*self._data['exc_info'])
  File "/usr/lib/python3/dist-packages/pykka/_compat/__init__.py", line 29, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 193, in _actor_loop
    response = self._handle_receive(envelope.message)
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 299, in _handle_receive
    return callee(*message.args, **message.kwargs)
  File "/home/nick/Dev/mopidy-dev/mopidy-local/mopidy_local/library.py", line 105, in get_distinct
    return set(schema.list_distinct(self._connect(), field, q))
  File "/home/nick/Dev/mopidy-dev/mopidy-local/mopidy_local/schema.py", line 204, in list_distinct
    raise LookupError("Invalid search field: %s" % field)
LookupError: Invalid search field: track