I wanted to write this post ever since I’ve read Radu’s Fortune and Pidgin’s status on Ubuntu post. Radu’s approach is quite lame and hard to use, because it relies on the user exporting a SQL dump file every time he posts something on the blog.
And really, do you need *all* the posts in the database? Do you really want to advertise blog entries from 2 years ago? Come on!
My idea is much better…obviously
…and it goes like this: parse the blog’s RSS and take “inspiration” from there for the statuses. The weapon of choice for this task is python with its feedparser library.
First, some prerequisites:
sudo apt-get install python-feedparser
…and then, the python script:
#!/usr/bin/python import feedparser import random import os # feed url FEED = 'http://feeds2.feedburner.com/motanelu' feed = feedparser.parse( FEED ) index = random.randrange(0, len( feed['items'] ) - 1 ) status = 'purple-remote "setstatus?status=available&message=%s %s"' % ( feed['items'][index].title, feed['items'][index].link ) os.system( status ) # EOF
I consider this approach better than Radu’s, because it doesn’t require exporting the database or messing around with fortune. Read this post to see how to update Pidgin’s status using cron. And enjoy
Starting yesterday, my Pidgin stopped connecting to Yahoo!’s messenger service (MSN kept working). Being lazy, I’ve just changed the scs.msg.yahoo.com host to 66.163.181.166 in the user profile panel – the first solution I’ve came across on Google – and it started working again. For another day or so.