X-Git-Url: https://git.ucc.asn.au/?p=uccvend-vendserver.git;a=blobdiff_plain;f=sql-edition%2Fservers%2FIdler.py;h=89783e355b63e314dda2f6aeed9dfb8400c335ed;hp=fc7573a0fc519a04a93e0e816af337fb403bae93;hb=14220792cd48d1600c0d4677ce37006fd1adb204;hpb=91714f5d8c77c1dff1a169cce7c5874b053b7810 diff --git a/sql-edition/servers/Idler.py b/sql-edition/servers/Idler.py index fc7573a..89783e3 100755 --- a/sql-edition/servers/Idler.py +++ b/sql-edition/servers/Idler.py @@ -230,6 +230,9 @@ class ClockIdler(Idler): self.v.display(" %8.8s " % (output)) self.last = output + def affinity(self): + return 3 + class FortuneIdler(StringIdler): def __init__(self, v): fortune = "/usr/games/fortune" @@ -242,4 +245,30 @@ class FortuneIdler(StringIdler): StringIdler.__init__(self, v, text,repeat=False) def affinity(self): - return 15 + return 20 + +class PipeIdler(StringIdler): + def __init__(self, v, command, args): + text = "I ate my cookie...." + if os.access(command,os.F_OK|os.X_OK): + (stdout, stdin) = popen2.popen2(command+' '+args) + text = string.join(stdout.readlines()) + stdout.close() + stdin.close() + StringIdler.__init__(self, v, text,repeat=False) + + def affinity(self): + return 20 + +class FileIdler(StringIdler): + def __init__(self, v, thefile=None, repeat=False): + text = "I broke my wookie...." + + if file and os.access(thefile,os.F_OK|os.R_OK): + f = file(thefile,'r') + text = string.join(f.readlines()) + f.close() + StringIdler.__init__(self, v, text,repeat=repeat) + + def affinity(self): + return 8