Re: [Deskbar] Rhythmbox Handler



Ryan Rousseau schrieb:
> Alright, an updated version of the plugin is up at
> http://byte.csc.lsu.edu/~rrouss7/deskbar_plugins/rhythmbox/rhythmbox.py
>
> I use xml.parsers.expat to parse ~/.gnome2/rhythmbox/rhythmdb.xml
>
> I also set the Library handler to return only 5 results per query
> (which may fix some of the slowness)
>
> As far as placing the results in their own category, I'm not aware of
> a way to create a new category (like 'Music').  Perhaps the Deskbar
> team can enlighten me.
>
Unfortunatly, you have to edit deskbar-applet itsself. You have to add
your category to Categories.py and call it by the dictionary's key.

> I still think keeping a list of the songs is the more efficient way to
> handle them (see the Muine example at
> http://live.gnome.org/DeskbarApplet/Extending).  In my opinion it's
> better to parse the file only when it is changed and create the list
> of X songs (~2700 in your case) rather than parse the file every time
> there is a query sent to the handler.
>
> I don't think very much space is needed by the list of songs anyhow.
> Currently it's a list of tuples containing (song title, artist name,
> file path).  I would guess that most of these have a combined total of
> 75-150 characters.  Even with the Python object overhead, a list of
> 3000 songs should still be less than 1 Mb which is manageable.
>
> I just really don't like the idea of parsing the file every single
> time a query is sent (everytime a character is pressed, especially if
> the person is not searching for music).  If I could find a way around
> that I wouldn't mind making a change, but until then I'm going to keep
> the songs in a list.
>
> Try it out again and see if limiting the query results helped the speed.
>
You're right. Parsing the XML file at startup increased the speed
dramaticly. In addition, you could increase the maximum number of results.
I tried 50 and it still works fine.

> Thanks for the suggestions,
Here are some more:

First of all, you should not only search the song title but at least the
artist, too. Maybe you want to search in the album's name, too.

Furthermore, I get the following error if I try to unload the handler from
the preferences dialog:

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/deskbar/ModuleLoader.py", line
208, in stop_module
    context.module.stop ()
  File "/home/sebp/.gnome2/deskbar-applet/handlers/rhythmbox.py", line
115, in stop
    for watched in self.watcher.watched:
RuntimeError: dictionary changed size during iteration

-- 
Greetings,
Sebastian Pölsterl



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