Update of /cvsroot/quickrip/quickrip
In directory sc8-pr-cvs1:/tmp/cvs-serv11451
Modified Files:
base.py
Log Message:
Half-way to getting threading working. CommandThread() class and
QuickRip.run() method look fine to me, but for some reason the
getDVDInfo() method (and its associated update method beneath it) is
failing to work with it. I'm stumped at the moment.
N.B. None of the methods will work atm, I've just been using
getDVDInfo() as a test.
Index: base.py
===================================================================
RCS file: /cvsroot/quickrip/quickrip/base.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** base.py 7 Aug 2003 02:16:49 -0000 1.7
--- base.py 7 Aug 2003 19:01:54 -0000 1.8
***************
*** 19,26 ****
class CommandThread(threading.Thread):
"""Handle threading of external commands"""
! def __init__(self, command, flushbuffer):
threading.Thread.__init__(self)
! self.command = command
self.flushbuffer = flushbuffer
def run(self):
--- 19,28 ----
class CommandThread(threading.Thread):
"""Handle threading of external commands"""
! def __init__(self, command, updatefunc, flushbuffer):
threading.Thread.__init__(self)
! self.updateFunc = updatefunc
self.flushbuffer = flushbuffer
+ self.command = command
+
def run(self):
***************
*** 35,39 ****
if not line:
break
! yield line
except:
# For PyGtk... weird!
--- 37,42 ----
if not line:
break
! else:
! self.updateFunc(line)
except:
# For PyGtk... weird!
***************
*** 50,53 ****
--- 53,58 ----
pass
+ sys.exit(2)
+
def kill_pipe(self):
***************
*** 61,64 ****
--- 66,70 ----
+
class QuickRip:
"""QuickRip base class, including the following methods:
***************
*** 169,181 ****
! def run(self, program, arguments, flushbuffer=0):
"""Runs a program; supply program name (string) and arguments (list)"""
command = arguments
command[:0] = [self.config[program]]
! self.thread = CommandThread(command, flushbuffer)
!
! for line in self.thread.run():
! yield line
--- 175,185 ----
! def run(self, program, arguments, updatefunc, flushbuffer=0):
"""Runs a program; supply program name (string) and arguments (list)"""
command = arguments
command[:0] = [self.config[program]]
! self.thread = CommandThread(command, updatefunc, flushbuffer)
! self.thread.start()
***************
*** 192,209 ****
"""Find number of titles on DVD"""
arguments = ['-vo', 'null', '-ao', 'null', '-v', 'dvd://', '-identify', '-quiet', '-nocache']
- numtitles = 0
- re_title = re.compile('There are (\d*) titles on this DVD')
- re_error = re.compile('libdvdread: Could not open device')
- for line in self.run('mplayer', arguments):
- if re_error.search(line):
- self.int_noTitles()
- if re_title.search(line):
- numtitles = int(re_title.search(line).group(1))
! if not numtitles:
self.int_noTitles()
!
! return numtitles
--- 196,210 ----
"""Find number of titles on DVD"""
arguments = ['-vo', 'null', '-ao', 'null', '-v', 'dvd://', '-identify', '-quiet', '-nocache']
+ self.re_title = re.compile('There are (\d*) titles on this DVD')
+ self.re_error = re.compile('libdvdread: Could not open device')
+ self.run('mplayer', arguments, self.up_DVDInfo)
! def up_DVDInfo(self, line):
! if self.re_error.search(line):
self.int_noTitles()
! elif self.re_title.search(line):
! self.numtitles = int(re_title.search(line).group(1))
! print "***GOT NUMTITLES***"
***************
*** 255,259 ****
self.numtitles = 0
! self.numtitles = self.getDVDInfo()
if self.numtitles is 0:
return
--- 256,261 ----
self.numtitles = 0
! self.getDVDInfo()
!
if self.numtitles is 0:
return
|