Is this a bug? Or using both type
and max-age
is not supported?
AFAICT, it’s not a bug, but a limitation of current implementation.
Enabling verbose logging I see that the expected SQL select against album
table is performed:
janv. 26 09:13:07 argos mopidy[7594]: DEBUG [HttpServer] mopidy.http.handlers Received RPC message from ::1: b'{\n "jsonrpc": "2.0",\n "id": 1,\n "method": "core.library.browse",\n "params": {"uri": "local:directory?type=album&max-age=100000"}\n}\n'
janv. 26 09:13:07 argos mopidy[7594]: DEBUG [LocalBackend-8] mopidy_local.schema SQLite browse query ['100000']:
janv. 26 09:13:07 argos mopidy[7594]: SELECT 'album' AS type, uri AS uri, name AS name
janv. 26 09:13:07 argos mopidy[7594]: FROM album
janv. 26 09:13:07 argos mopidy[7594]: WHERE EXISTS (
janv. 26 09:13:07 argos mopidy[7594]: SELECT *
janv. 26 09:13:07 argos mopidy[7594]: FROM track
janv. 26 09:13:07 argos mopidy[7594]: WHERE album = album.uri
janv. 26 09:13:07 argos mopidy[7594]: AND last_modified >= (strftime('%s', 'now') - ?) * 1000
janv. 26 09:13:07 argos mopidy[7594]: )
janv. 26 09:13:07 argos mopidy[7594]: ORDER BY type, name COLLATE NOCASE
but LocalLibraryProvider._browse_directory()
implementation build references to directories even when the matched results are albums: https://github.com/mopidy/mopidy-local/blob/master/mopidy_local/library.py#L174
for ref in schema.browse(
self._connect(), type, order, role=roles, **query
): # noqa
if ref.type == Ref.TRACK or (not query and not role):
refs.append(ref)
elif ref.type == Ref.ALBUM:
refs.append(
Ref.directory(
Not clear why…
…and the returned resources are references to directories, not albums, with (strange?) URIs containing the max-age
parameter:
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"__model__": "Ref",
"uri": "local:directory?max-age=100000&type=track&album=local:album:md5:561ebf4a3367cb89f30cd17461fb10b3",
"name": "The Dark Side of the Moon",
"type": "directory"
}
]
}
which is not homogeneous with results of querying the more URI local:directory?type=album
(where references to albums are returned):
{
"jsonrpc": "2.0",
"id": 2,
"result": [
{
"__model__": "Ref",
"uri": "local:album:md5:edbdf98220f9fc7c284011adf7f043a0",
"name": "\"Charlie\"",
"type": "album"
},