From Fedora Project Wiki

No edit summary
No edit summary
Line 18: Line 18:
timeout = 2500
timeout = 2500
interface.Notify('name',id,'','summary','body','','',timeout)
interface.Notify('name',id,'','summary','body','','',timeout)
</pre>
=== RSS Feed Python Reader Example ===
A cool tutorial from <code>http://www.learningpython.com/2006/01/14/rss-reader-part-one/</code> teach how to create a simple Python application to read any RSS feed (I tweaked the script a bit little).
<pre>
import urllib2
from xml.dom import minidom, Node
xmldoc = minidom.parse(urllib2.urlopen('https://fedoraproject.org/w/index.php?title=Special:RecentChanges&feed=rss'))
if (xmldoc):
rootNode = xmldoc.documentElement
for node in rootNode.childNodes:
if node.nodeName == "channel":
rootNode = node
break
for node in rootNode.childNodes:
if (node.nodeName == "item"):
for item_node in node.childNodes:
if (item_node.nodeName == "title"):
title = ""
for text_node in item_node.childNodes:
if (text_node.nodeType == node.TEXT_NODE):
title += text_node.nodeValue
if (len(title)>0):
print title
if (item_node.nodeName == "description"):
description = ""
for text_node in item_node.childNodes:
if (text_node.nodeType == node.TEXT_NODE):
description += text_node.nodeValue
if (len(description)>0):
print description + "\n"
else:
print "Error getting XML document!"
</pre>
</pre>



Revision as of 18:11, 5 August 2010

Project Name
Till now there's no official name. However, a redirect page called hermes has been created to preserve a name for the project.

The Reason

A large number of Fedora users don't read the Fedora wiki & websites, thus, they miss important tips & notifications.

The Concept

A simple application that reads a multilanguage web feed & post a new notification to the system D-Bus notifications system.

Prototypes

Python D-Bus Notifications Example

This is a simple Python application to post a notification to the system D-Bus notifications system:

import dbus
bus = dbus.SessionBus()
notifications = bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
interface = dbus.Interface(notifications, 'org.freedesktop.Notifications')
id = 4856
timeout = 2500
interface.Notify('name',id,'','summary','body','','',timeout)

RSS Feed Python Reader Example

A cool tutorial from http://www.learningpython.com/2006/01/14/rss-reader-part-one/ teach how to create a simple Python application to read any RSS feed (I tweaked the script a bit little).

import urllib2
from xml.dom import minidom, Node
xmldoc = minidom.parse(urllib2.urlopen('https://fedoraproject.org/w/index.php?title=Special:RecentChanges&feed=rss'))
if (xmldoc):
	rootNode = xmldoc.documentElement
	for node in rootNode.childNodes:
		if node.nodeName == "channel":
			rootNode = node
			break
	for node in rootNode.childNodes:
		if (node.nodeName == "item"):
			for item_node in node.childNodes:
				if (item_node.nodeName == "title"):
					title = ""
					for text_node in item_node.childNodes:
						if (text_node.nodeType == node.TEXT_NODE):
							title += text_node.nodeValue
					if (len(title)>0):
						print title
					if (item_node.nodeName == "description"):
					description = ""
					for text_node in item_node.childNodes:
						if (text_node.nodeType == node.TEXT_NODE):
							description += text_node.nodeValue
					if (len(description)>0):
						print description + "\n"
else:
	print "Error getting XML document!"

Benefit to Fedora

More interaction from new users