Qball's Weblog

GMPC plugin: Album View

Tags gmpc 

Several times before I tried to write a plugin that shows a list of all albums covers, this is an option found in most “standalone music managers” (itunes, etc).

Mostly I gave up quickly after noticing that Gtk does not handle this (complained about it here too).

A while back I, again, wrote a albumview, that uses a exo-wrap-table to display a lot of GmpcMetaImage. The metaimage have a nice hack that they only start quering the art when visible (on the first expose event). This made the plugin somewhat doable.  But still if you have 2000 albums, it was pretty much a no go.

So today, I decided to do it right™.  It only displays and packs the visible widgets at the same time, if you scroll it just display the next X widgets.

This saves a HUGE amount of time. The next optimalisation is to avoid having to create the widget, look in the database for the cover art, load the image and display it every time  you scroll over the same image,  the widgets are cached.

Once the cache is “warm” (or how the hell you call it) it is lightning fast,  and even with a “cold” cache it is very very doable.  Filtering the list is instant as you type, again withouth much delay. The only downside is the memory usage, but it is either that or speed. (that is also why it is a plugin and not integrated.)

If you want to give it a try, you can find the source for the plugin here. If I have some time to spare, I will see if I can create a generic widget for this.

Owh, and offcourse a movie showing it: http://random.sarine.nl/gmpc-albumview-su3.ogv. You might want to download it before watching, it is kinda large.


edit: I can still think of many optimalisations to make, to speed it up further.