The world cup cricket final is happening again. Though I am not an ardent cricket fan, I do love it , but not without criticism as usual.
I was thinking about today’s final betwen Sri Lanka and Australia. I vote for Australia as they are more professional in cricket ( I don’t care abt the players behaviour, as I don’t value the sweetness in the player’s behaviour, I just valuate them by their performance on ground , not off the ground).
As I am in office, I have decided to view the latest scores available in Cricinfo website. But as it is not so easy to open and view the website regularly, I have decided to write a Python script to show the latest scores on the Screen (OSD :-0 On screen Display).
First I have installed the XOSD fromhttp://sourceforge.net/projects/libxosd. Then I have installed the pyosd using the rpm
pyosd-0.2.6-1asp.i386.rpm . To solve the issues in my Redhat Enterprise Linux 4, I have copy the usr/lib/python2.2/site-package
# Started on 26, Apr 2007 by Maxin B. John <email@example.com>
# This file is licensed under the GPL.
#importing the Pyosd and xml parser
from xml.sax import handler, make_parser
import sys, string , time
def __init__(self, outfile):
self.outfile = outfile
self.level = 0
self.titles = “”
self.displayer.display( self.description )
def startElement(self, name, attrs):
self.level += 1
def endElement(self, name):
def characters(self, chrs):
if self.xmlcontent == ‘pubDate’:
if self.xmlcontent == ‘title’:
if self.xmlcontent == ‘description’:
outFile = sys.stdout
# Create an instance of the Handler.
handler = SaxDocumentHandler(outFile)
# Create an instance of the parser.
parser = make_parser()
# Set the content handler.
# Parse the file
# sleeping for 5 seconds to prevent a sudden exit
args = sys.argv[1:]
#if len(args) != 1:
# print ‘usage: python cricketonscreen.py http://www.cricinfo.com/rss/livescores.xml’
# Here we are depending on cricinfo for the latest scores
#Finally triger the events
if __name__ == ‘__main__’:
Well, it’s because the match has’nt started yet. When the match starts, I will get the live scoresReadmore