Beispiel #1
0
 def start(self, duration=None):
     args = [self.driver.executable, self.driver.stream, "-A"]
     if duration:
         args.extend(["-l", "%d" % duration])
         self.duration = duration
         self.expected_shutdown = time.time() + duration - 5
     else:
         self.expected_shutdown = self.duration = None
     self.output_path = self._get_output_path()
     args.extend(["-a", self.output_path])
     
     self.start_time = time.time()
     black_hole = os.devnull or "/dev/null"
     self.stdin = open(black_hole, "r")
     self.stdout = open(black_hole, "w")
     
     try:
         self._process = subprocess.Popen(args, stdin=self.stdin,
             stdout=self.stdout, stderr=subprocess.STDOUT)
         self._ended = False
         self.fire("start", session=self, process=self._process,
             duration=duration)
         monitor_process(self._process, self._proc_ended)
     except Exception, e:
         self.fire("error", session=self,
             error="failed to start recording: %s" % e)
Beispiel #2
0
 def start(self, duration=None):
     args = [self.driver.executable]
     if duration:
         args.extend(["-d", "%d" % duration])
         self.duration = duration
         self.expected_shutdown = time.time() + duration - 5
     else:
         self.expected_shutdown = self.duration = None
     
     if self.driver.format:
         args.extend(["-f", self.driver.format])
     if self.driver.bitrate:
         args.extend(["-b", "%d" % self.driver.bitrate])
     if self.driver.channels:
         args.extend(["-c", "%d" % self.driver.channels])
     if self.driver.ports:
         args.extend(["-p", ','.join(self.driver.ports)]);
     if self.driver.client_name:
         args.extend(["-n", self.driver.client_name])
     
     self.output_path = self._get_output_path()
     
     args.append(self.output_path)
     
     self.start_time = time.time()
     black_hole = os.devnull or "/dev/null"
     self.stdin = open(black_hole, "r")
     self.stdout = open(black_hole, "w")
     
     try:
         self._process = subprocess.Popen(args, stdin=self.stdin,
             stdout=self.stdout, stderr=subprocess.STDOUT)
         self._ended = self._stopped = False
         self.fire("start", session=self, process=self._process,
             duration=duration)
         monitor_process(self._process, self._proc_ended)
     except Exception, e:
         self.fire("error", session=self,
             error="failed to start recording: %s" % e)