> Hi,
> 
> This commit appears to break my client:
> http://git.xmms2.org/xmms2/xmms2-devel/commit/?id=bbbe4bef56979446145
> c67c1d561aa3dc5332773
> 
> Specifically, attempting to fetch the "id" data field with coll_query
> no longer returns the "song_id" field as it previously did. Without
> the id I don't know how to jump to this song in my playlist, play it,
> etc.
> 
> -Graham
> 
> --

Hi,

Take a look at https://xmms2.org/wiki/Collections_2.0#Querying for the
correct way to use coll_query(). The 'id' is not actually a field: it's
a key representing an entry in the medialib. The 'song_id' field was
never meant to be exposed. You need to request the id explicitly by
using the 'get' attribute in your metadata spec. If you don't care
about the order of the result, you can use this (python syntax):

xmms.coll_query(coll, dict(
    type='metadata',
    get=('id', 'field', 'value')
    ))

which will return a dict of entries where keys are the songs ids and
the value is a dict of field=>value.

If you do care about the order, you can use something like this:

xmms.coll_query(coll, {
    'type': 'cluster-list',
    'cluster-by': 'position',
    'data': {
        'type': 'metadata',
        'get': ('id', 'field', 'value')
        }
    })

You'll get a list in the form:
[{'42': { 'artist': '...', 'album': '...', ...}},
 {'1337': { ... }},
 ...
 ]


In the hope this helps.

Regards,
Raphaël.

--
_______________________________________________
Xmms2-devel mailing list
Xmms2-devel@lists.xmms2.org
http://lists.xmms2.org/cgi-bin/mailman/listinfo/xmms2-devel

Reply via email to