Jaiku Planet Venus Filter

Just started exploring Jaiku and, coincidentally, Planet Venus. One of the cool things about Jaiku is that it aggregates your other web presences (like your blog, twitter, del.icio.us, and flickr posts) and integrates them into Jaiku presence stream. The down side of this is that it's not as good at that as Planet Venus, and then if you use Planet Venus to create a aggregation of your web presences and you include Jaiku, then you've got annoying duplication.

So, I'm not much of a Python programmer, but I wrote this Planet Venus filter that looks at each entry, and if it detects that it's a Jaiku presence update, it only includes it if it originated via Jaiku. In other words, it filters out all the duplicates.

If you understood any of that, you may find this helpful. If not, nevermind.


"""
For jaiku presence entries, only retain entries that originate from jaiku
(as opposed to grabbed via web feeds)
"""
import sys, xml.dom.minidom
entry = xml.dom.minidom.parse(sys.stdin).documentElement
entry_id = entry.getElementsByTagName('id')[0].firstChild.data
for node in entry.getElementsByTagName('link'):
if node.getAttribute('rel') == 'alternate':
entry_link = node.getAttribute('href')
break
if entry_id.find('jaiku.com/presence') > 0 and (entry_id != entry_link):
sys.exit(1)
print entry.toxml('utf-8')

(Updated to fix a bug on line 11.)