Re: [Rhythmbox-devel] Magnatune catalog/purchasing plugin



On Thu, Jun 15, 2006 at 09:14:41AM -0700, Adam Zimmerman wrote:
> OK, I'm almost there! There are still a couple issues though.
> 
> On Thu, 2006-15-06 at 20:41 +1000, Jonathan Matthew wrote:
> > Sources display entries using an RBEntryView instance (or rb.EntryView
> > in python).  The RBEntryView is a tree view backed by a
> > RhythmDBQueryModel, which is a GtkTreeModel that contains a set of
> > entries matching particular criteria.  So, an entry is shown in any
> > source for which it matches the query.
> > 
> 
> I've made all the changes you suggested, and my source now shows up in
> the list. But when I click on it, I just see a blank grey box. Do I need
> to create my own EntryView? I can't see where the ipod source does it,
> but that could just be my weak (i.e., nonexistent) C skillz :P

Yes, it seems that you do.  The ipod source doesn't create one because
its parent class, RBBrowserSource, does it.  It looks like you can do
this:

 self.entry_view = rb.EntryView(db, shell_player, "", False, False)

which causes a gconf error but otherwise seems to work.  I think we'll
need to fix the python bindings a bit to get rid of the error.  Then
you'd add the columns you want to display:

  self.entry_view.append_column(rb.ENTRY_VIEW_COL_TITLE, False)
  self.entry_view.append_column(rb.ENTRY_VIEW_COL_ARTIST, False)
  self.entry_view.append_column(rb.ENTRY_VIEW_COL_ALBUM, False)
  self.entry_view.append_column(rb.ENTRY_VIEW_COL_GENRE, False)

and attach the query model:

  self.entry_view.set_model(self.model)

and add it to the source widget:

  self.pack_start(self.entry_view)
  
I haven't really tested much of this, but it should work.

> Also, duplicate URIs cause rhythmdb to give a warning. This happens a
> few times in song_info.xml, but it also happens for every track after
> the plugin is unloaded and then loaded again.

When your plugin is unloaded, you should delete all db entries of your
entry type:
 
  self._db.entry_delete_by_type(self.entry_type)

or something.

> Finally, loading the plugin blocks the UI for about 2 minutes while the
> tracks are being parsed. I tried (as you can see from the code) putting
> the call to xml.sax.parse into a Thread object, but when I tried that
> the method didn't run at all (the source showed up, but the "Adding
> artist - title" string never got printed). Is there something else I can
> do so my code doesn't block the UI?

We don't currently enable python threads.  I'm not sure what's involved
in enabling them.  I'm also not sure what else you could do.  Sorry.




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