Update of /cvsroot/quickrip/quickrip
In directory sc8-pr-cvs1:/tmp/cvs-serv30536
Modified Files:
base.py
Log Message:
Some minor reg exp cleanups, and an attempt at locking threads to solve
scanning problem (not that it works for me!)
Index: base.py
===================================================================
RCS file: /cvsroot/quickrip/quickrip/base.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** base.py 8 Aug 2003 07:08:41 -0000 1.10
--- base.py 9 Aug 2003 00:07:13 -0000 1.11
***************
*** 19,23 ****
class CommandThread(threading.Thread):
"""Handle threading of external commands"""
! def __init__(self, command, updatefunc, finalfunc, flushbuffer, data):
threading.Thread.__init__(self)
self.updateFunc = updatefunc
--- 19,23 ----
class CommandThread(threading.Thread):
"""Handle threading of external commands"""
! def __init__(self, command, updatefunc, finalfunc, flushbuffer, data, lock):
threading.Thread.__init__(self)
self.updateFunc = updatefunc
***************
*** 26,29 ****
--- 26,30 ----
self.command = command
self.data = data
+ self.lock = lock
def run(self):
***************
*** 31,34 ****
--- 32,37 ----
pid = self.pipe.pid
totallines = []
+ if self.lock:
+ self.lock.acquire()
while 1:
try:
***************
*** 58,62 ****
if self.finalFunc != None:
self.finalFunc(totallines, self.data)
!
sys.exit(2)
--- 61,66 ----
if self.finalFunc != None:
self.finalFunc(totallines, self.data)
! if self.lock:
! self.lock.release()
sys.exit(2)
***************
*** 180,184 ****
def run(self, program, arguments, finalfunc=None, updatefunc=None,
! flushbuffer=0, data=None):
"""Runs a program; supply program name (string) and arguments (list)"""
command = arguments
--- 184,188 ----
def run(self, program, arguments, finalfunc=None, updatefunc=None,
! flushbuffer=0, data=None, lock=None):
"""Runs a program; supply program name (string) and arguments (list)"""
command = arguments
***************
*** 186,190 ****
self.thread = CommandThread(command, updatefunc, finalfunc,
! flushbuffer, data)
self.thread.start()
--- 190,194 ----
self.thread = CommandThread(command, updatefunc, finalfunc,
! flushbuffer, data, lock)
self.thread.start()
***************
*** 227,235 ****
rettext += line
if self.re_error.search(rettext):
- print "no titles"
self.ui_noTitles()
elif self.re_title.search(rettext):
self.numtitles = int(self.re_title.search(rettext).group(1))
- print "***GOT NUMTITLES***"
if self.numtitles is 0:
--- 231,237 ----
***************
*** 240,250 ****
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)
def total_TitleInfo(self, lines, data):
! re_error = re.compile('No such file or directory')
! re_time = re.compile('.*title playback time: (.*):(.*):(\d*)\.\d* (\d*) sec')
re_chap = re.compile('(\d*) chapter\(s\), ')
re_alang = re.compile('.* ac3 (\w*) ')
--- 242,253 ----
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):
! re_error = re.compile("".join(["Can't open ", self.config['dvd_device'], " for reading"]))
! re_time = re.compile('title playback time: (\d+):(\d+):(\d+)\.\d+\s+(\d*) sec')
re_chap = re.compile('(\d*) chapter\(s\), ')
re_alang = re.compile('.* ac3 (\w*) ')
***************
*** 253,262 ****
alangs = []
slangs = []
- chapters = 0
- time = 0
- time_label = "0 hrs 0 mins 0 secs"
for line in lines:
if re_error.search(line):
self.ui_noTitles()
return
--- 256,264 ----
alangs = []
slangs = []
for line in lines:
+ print str(data) + line
if re_error.search(line):
+ print "error on" + str(data)
self.ui_noTitles()
return
***************
*** 462,465 ****
--- 464,470 ----
## INHERIT THE CLASS AND SUBSTITUE THESE CLASS METHODS WITH YOUR
## OWN UI HOOKS
+ def ui_configError(self):
+ pass
+
def ui_startScanning(self):
pass
|