snoot.org message board: SICO monitoring tool (zoom)

[ back | refresh | last 25 | post new ]

SICO monitoring tool
[935] by "Tambreet" (lca3118.lss.emc.com)   on Fri 09 Jun 2000 16:56:02     reply ] [ top ]
I don't know if this will be useful, but if you're a SICO addict and you use Python, this will pop up whenever something changes. It's pretty brain-dead really, but it works surprisingly well.

(If the SICO message-board code adds line breaks, this is gonna look like crap).

#!/usr/bin/python

import re
import string
import sys
import time
import urllib
import Tkinter

regex = re.compile('Game ([0-9]+).*last move.*by.*<i>(.*)</i>')

def GetMovers ():
result = []
try:
for line in urllib.urlopen('http://snoot.org/toys/sico/').readlines():
match = regex.search(line)
if match:
number = match.group(1)
site = match.group(2)
result.append((number,site))
except:
pass
return result

def ShowMovers (gameList):
w = Tkinter.Tk()
w.wm_title('SICO')
tb = Tkinter.Text(w,height=len(gameList),width=40)
tb.grid(row=0,column=0,sticky='nsew')
for game in gameList:
tb.insert(Tkinter.END,'Game %s: %s\n'%game)
ok = Tkinter.Button(w,text='OK',command=w.quit)
ok.grid(row=1,column=0,sticky='ns')
w.mainloop()
w.destroy()

if __name__ == '__main__':
oldList = []
while 1:
newList = GetMovers()
if newList and (newList != oldList):
ShowMovers(newList)
oldList = newList
time.sleep(60)