From: <iwa...@us...> - 2003-08-06 11:01:10
|
Update of /cvsroot/quickrip/quickrip In directory sc8-pr-cvs1:/tmp/cvs-serv26944 Modified Files: base.py Added Files: commandthread.py Log Message: minor touchups in base.py, see lines 248 and 253. New commandthread module is here for real. --- NEW FILE: commandthread.py --- #!/usr/bin/python #CommandThread: Steven Grafton #execute a shell command in a threaded process import threading from threading import * import sys, os, re, popen2, ConfigParser, copy from time import sleep class CommandThread(Thread): def __init__(self, command, doneFunc): Thread.__init__(self) self.command = command self.resultsRead = 0 self.results = "" self.doneFunc = doneFunc pass def run(self): print "command process: " + self.command self.pipe = popen2.Popen4(self.command) pid = self.pipe.pid while 1: try: line = self.pipe.fromchild.readline() if not line: break self.results += line except: # For PyGtk... weird! continue # Clean up process table self.kill_pipe() try: os.waitpid(pid, os.WNOHANG) except: pass self.doneFunc(self.results) def kill_pipe(self): """Kills current process (pipe)""" try: os.kill(self.pipe.pid, 9) os.waitpid(self.pipe.pid, os.WNOHANG) except: pass Index: base.py =================================================================== RCS file: /cvsroot/quickrip/quickrip/base.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** base.py 6 Aug 2003 01:36:05 -0000 1.3 --- base.py 6 Aug 2003 11:01:07 -0000 1.4 *************** *** 245,253 **** title['size'] = 680 title['vbr'] = self.calcRate(int(time), 96, 680) title['rip'] = "no" title['alangs'] = alangs title['alang'] = 'en' title['slangs'] = slangs ! title['slang'] = '' self.titles.append(title) --- 245,254 ---- title['size'] = 680 title['vbr'] = self.calcRate(int(time), 96, 680) + title['abr'] = 128 #biggs added title['rip'] = "no" title['alangs'] = alangs title['alang'] = 'en' title['slangs'] = slangs ! title['slang'] = ' ' # biggs changed to a double space self.titles.append(title) |