Conky is a great tool for monitoring CPU, memory, and network usage. It also has now playing integration for MPD, XMMS, BMPx, and Audacious. But it completely lacks integration with my music player of choice, Banshee, and it also has no built-in way to check my progress in BOINC, a distributed computing project. On the other hand, which Conky does have is built-in support for executing arbitrary programs and parsing the result as markup/text. So I wrote a couple quick Python scripts, one to get now-playing data from Banshee and put it in a nice format, and the other to grab progress data from BOINC and calculate percent completion and estimated time until completion.

Conky with Banshee and BOINC scripts
To use the Banshee script, you need to start banshee-conky-daemon.py on startup (it echoes the data to a file in /tmp to avoid constantly invoking the script and causing noticeable skipping in Banshee). In Ubuntu 9.04, you can do this by going to System->Preferences->Startup Applications and adding a new entry for ‘python ~/banshee-conky-daemon.py’ (assuming you put it there). Then add ${execp cat /tmp/banshee-conky-daemon} to your .conkyrc wherever you want the output in conky. If you keep conky at a different width, you might need to mess around with the trimming numbers on line 33.
The BOINC script is simpler; just add ${execpi boinc-conky.py} to your .conkyrc. Red tasks are actively being worked on, green ones aren’t. Only tasks that have been started are shown. The dict maps project URLs to short names; if you find the program crashing with KeyErrors, just add an entry to the dict that maps the missing key to a description eight letters or less (the restriction is to maintain proper time estimate alignment; it can be changed).
If you have questions, leave a comment. Apologies for the lack of comments in code; I’ll answer any questions you may have. I promise to code with comments from now on.
Leave a Reply