Re: [Rhythmbox-devel] Python plugins as Sources



On Tue, 2006-11-14 at 20:47 +0100, Tom Parker wrote:
> 1) I'm aiming towards being able to fix 
> http://bugzilla.gnome.org/show_bug.cgi?id=328526 ("Add metadata cache 
> for audio players"), which means I need to get hold of entries to store. 
> I'm using add_uri_with_type from the db to avoid doing the heavy lifting 
> of setting artist/title/album myself, but this means I can't seem to get 
> the entry references back. entry_lookup_by_location doesn't appear to be 
> doing the right thing. Anything I hand to it gets me a None back. I've 
> tried this both from my plugin, and from the python console with a url 
> of a file not on the media player device. I've tried both with and 
> without "file:///" stuff on the beginning.

This is where we need to write some more API docs, about what exactly
all these methods do. RhythmDB.add_uri_with_type () requests that the
given file be imported into the db, with the specified type. As when you
import tracks into your library it doesn't happen immediately, the db
will queue it to import as soon as it has a chance.

If you need to do something with the resulting entry, what you should do
is connect to the db's "entry-added" signal, and check if the entry's
LOCATION property is one your waiting for.


> 2) Couldn't seem to get the debug stuff working. Ended up hacking in my 
> own debug function which looks like the following:
> 
> def debug(*args):
> 	print >>sys.__stderr__,"gps err: ",args
> 
> Using rb._debug did nothing at all... and I've just realised why. D'oh.. 
> Should have switched on the -D flag.

RB redirect stdout from python plugins to the debug system, so you can
sue normal "print ..." statements, and then put the filename/function
name after -D to selectively view it.


James "Doc" Livingston
-- 
"Every time I look at my speedometer, I get lost!"
    Heisenberg's Automotive Lament



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