I’m not sure how many of you will have heard of Gnome-DO — let alone the number that actually use it — but for those in the dark, let me illuminate. Gnome-DO is a program for GNU/Linux operating systems. It provides a close-at-hand interface that will attempt to match what you type to a command, then let you activate that command.
By default DO works as a handy launcher, but like many other FOSS programs, it uses a plugin system to add new functionality to the core program. There’s a whole whack of neat stuff in the plugins list, but we’re going to focus on the Rhythmbox plugin for now.
Rhythmbox is an iTunes-like music player and library manager, and it’s part of the GNOME project. It’s not the most featureful of its type, but it’s fairly light-weight, which is something I like since I tend to keep an instance of it open at all times.
The Rhythmbox plugin for DO gives you access to your library through DO and also gives a quick way to control what’s already playing. What it doesn’t do — and this is what I’ll focus on today, is provide a way to access the other handy features that Rhythmbox provides, like song ratings, library manipulation, and moving files to the trash without having to track them down. Well I wanted one of those; and impatient man that I am, I didn’t want to wait for someone else to add it, nor did I feel like figuring out how the Rhythmbox plugin worked to add the functionality myself.
With that in mind, I came up with this little hack to add the functionality I wanted.
The first step was to write a little script that would get the URI for the current song. Making use of Rhythmbox’s handy DBus interface this was easy enough. Unfortunately that interface doesn’t give much in the way of management functions, and doesn’t allow you to tell Rhythmbox to trash a song.
So from there I made use of the trash-cli package (installed from the Jaunty repositories) to add the ability to send a file to the Trash properly (according to the FreeDesktop.org specification). There was a little finagling needed to make sure that the path was in a useable format , but it was fairly straightforward.
I also wanted to make use of the new notification daemon in Jaunty, so I added in the ability to have it display a notification saying which file was trashed. For this, again, I went external and used the libnotify-bin package and its notify-send utility. Easy.
All of that, however, has nothing to do with DO. I could, of course, just put the script in a bin folder and just run the command manually, but that’s lame and not in the DO spirit. Instead I made use of the core DO functionality — launching applications — and created a .desktop file in one of its paths which ran my script with the desired components. Voila! After a quick restart of DO, I can now delete the superlame songs I’ve accumulated from various sources so they never plague my ears again!
My python script for deleting songs and the desktop file I created are available (as PDFs, ’cause WordPress understandably doesn’t want source file uploaded to their servers). The desktop file is just in my ~/Desktop folder, but it’s been hidden using a .hidden file. I’ve done a lot of fiddling with my icon set, so stuff won’t necessarily work as-is, but I wrote it to be easy to change.


9 December - 2009 at 1:00 am
Wow, I did not know about that up to now. Thankz!