From: <iwa...@us...> - 2003-08-09 02:02:37
|
Update of /cvsroot/quickrip/quickrip In directory sc8-pr-cvs1:/tmp/cvs-serv10712 Modified Files: base.py Log Message: Spawned bash threads now each share the same lock. Scanning large number of titles on dvds seems to work better now. Index: base.py =================================================================== RCS file: /cvsroot/quickrip/quickrip/base.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** base.py 9 Aug 2003 00:07:13 -0000 1.11 --- base.py 9 Aug 2003 02:02:34 -0000 1.12 *************** *** 15,18 **** --- 15,19 ---- import sys, os, re, popen2, ConfigParser, copy import config # QuickRip global configuration. + import thread *************** *** 29,37 **** def run(self): self.pipe = popen2.Popen4(self.command) pid = self.pipe.pid totallines = [] - if self.lock: - self.lock.acquire() while 1: try: --- 30,38 ---- def run(self): + # self.lock = thread.allocate_lock() + self.lock.acquire() self.pipe = popen2.Popen4(self.command) pid = self.pipe.pid totallines = [] while 1: try: *************** *** 61,66 **** if self.finalFunc != None: self.finalFunc(totallines, self.data) ! if self.lock: ! self.lock.release() sys.exit(2) --- 62,68 ---- if self.finalFunc != None: self.finalFunc(totallines, self.data) ! ! self.lock.release() ! sys.exit(2) *************** *** 190,194 **** self.thread = CommandThread(command, updatefunc, finalfunc, ! flushbuffer, data, lock) self.thread.start() --- 192,196 ---- self.thread = CommandThread(command, updatefunc, finalfunc, ! flushbuffer, data, self.lock) self.thread.start() *************** *** 206,209 **** --- 208,212 ---- """Scan the DVD and build up a data structure for the titles""" self.ui_startScanning() + self.lock = thread.allocate_lock() #threading.allocate_lock() # Reset values to default (in case user scans two different discs in same session) *************** *** 230,238 **** for line in lines: # there's prolly a better way to do this :) rettext += line if self.re_error.search(rettext): self.ui_noTitles() elif self.re_title.search(rettext): self.numtitles = int(self.re_title.search(rettext).group(1)) ! if self.numtitles is 0: return --- 233,243 ---- for line in lines: # there's prolly a better way to do this :) rettext += line + if self.re_error.search(rettext): self.ui_noTitles() elif self.re_title.search(rettext): self.numtitles = int(self.re_title.search(rettext).group(1)) ! ! if self.numtitles is 0: return *************** *** 242,249 **** for i in range(int(self.numtitles) + 1): if i is not 0: - lock = threading.Lock() """Find number of chapters, audio/subtitle languages & length for title""" arguments = ['-i', self.config['dvd_device'], '-T', str(i)] ! self.run('tcprobe', arguments, self.total_TitleInfo, None, 0, i, lock) def total_TitleInfo(self, lines, data): --- 247,256 ---- for i in range(int(self.numtitles) + 1): if i is not 0: """Find number of chapters, audio/subtitle languages & length for title""" arguments = ['-i', self.config['dvd_device'], '-T', str(i)] ! self.run('tcprobe', arguments, self.total_TitleInfo, None, 0, i) ! else: ! print "Error running programs!" ! print lines def total_TitleInfo(self, lines, data): *************** *** 258,264 **** for line in lines: ! print str(data) + line if re_error.search(line): ! print "error on" + str(data) self.ui_noTitles() return --- 265,271 ---- for line in lines: ! # print str(data) + line if re_error.search(line): ! print "error on " + str(data) self.ui_noTitles() return |