class DVDCopyJob: def __init__(self, type, source, title=None): self.source = source self.type = type self.title = title self.thread = threading.Thread(target=self.__copy) self.thread.start() def __copy(self): global drive_jobs args = [config.CONF.dvdbackup, '-i', self.source, '-o', config.DVDCOPY_DIR] if self.type == JOB_TYPE_FEATURE: args.append('-F') elif self.type == JOB_TYPE_TITLE: args.append('-t') args.append(self.title) else: args.append('-M') # Do the copy self.childapp = ChildApp(args) while self.childapp.isAlive(): time.sleep(0.2) drive_jobs[self.source] = None def cancel(self): self.childapp.kill()
def __copy(self): global drive_jobs args = [config.CONF.dvdbackup, '-i', self.source, '-o', config.DVDCOPY_DIR] if self.type == JOB_TYPE_FEATURE: args.append('-F') elif self.type == JOB_TYPE_TITLE: args.append('-t') args.append(self.title) else: args.append('-M') # Do the copy self.childapp = ChildApp(args) while self.childapp.isAlive(): time.sleep(0.2) drive_jobs[self.source] = None