Re: [Rhythmbox-devel] Python API question

On Tue, 2007-02-13 at 00:28 +1100, James "Doc" Livingston wrote:
> db = shell.props.db
> query = db.query_new()
> db.query_append (query, [rhythmdb.QUERY_PROP_EQUALS,
> rhythmdb.PROP_ARTIST, "The Living End"])
> What you should be able to do is call "qm = db.query_model_new(query)"
> to create a new query model with a given query. Creating it works fine
> at the moment, but it doesn't actually put anything in the query model -
> I'm planning to look into that tomorrow.

Oops, after creating the query mode you need to do a
"db.do_full_query_async_parsed (qm, query)". I've checked this works by
doing "qm.iter_n_children(None)" which reports that I have 75 tracks
matching the criteria.

There are several API improvements we could easyly make, such as having
queries know what db they belong to. This would mean you would write
"" instead of "db.query_foo()". Also automatically running
the query for the model, and being able to pass criteria to the query
constructor.  How does the following look, and can you think of anything

db = shell.props.db
query = rhythmdb.Query(db,
    [rhythmdb.QUERY_PROP_EQUALS, rhythmdb.PROP_ARTIST, "The Living End"])
qm = rhythmdb.QueryModel(db, query)


James "Doc" Livingston
The human genome is about 3 gigabases long, which boils down to 750
megabytes. Depressingly enough, this is only 2.8 Mozilla browsers."
    -- Jamie Zawinski

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]