[svn r666] * GMyth-Streamer trunk
authormorphbr
Tue May 15 23:25:17 2007 +0100 (2007-05-15)
branchtrunk
changeset 660ba4a948c4a55
parent 659 3816ffef9ff1
child 661 a4fb2dd520ba
[svn r666] * GMyth-Streamer
- Updated report status on mencoder.py
gmyth-stream/server/0.2/plugins/transcoders/mencoder.py
     1.1 --- a/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py	Tue May 15 22:35:57 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py	Tue May 15 23:25:17 2007 +0100
     1.3 @@ -196,7 +196,9 @@
     1.4                          os.write(stdw, data_in)
     1.5                          total_read += 4096
     1.6                          d = stdout.read(4096)
     1.7 -                        self.status = total_read * 100 / size
     1.8 +                        self.status = utils.progress_bar(self.log,
     1.9 +                                                         int(total_read),
    1.10 +                                                         int(size), 50)
    1.11                      else:
    1.12                          finished = True
    1.13                          os.close(stdw)
    1.14 @@ -260,34 +262,24 @@
    1.15          return ret
    1.16      # start()
    1.17  
    1.18 -
    1.19 -    def stop(self):
    1.20 -        if self.proc:
    1.21 +    def _aux_stop(self, obj):
    1.22 +        if obj:
    1.23              try:
    1.24 -                os.kill(self.proc.pid, signal.SIGKILL)
    1.25 +                os.kill(obj.pid, signal.SIGKILL)
    1.26              except OSError, e:
    1.27                  pass
    1.28  
    1.29              try:
    1.30 -                self.proc.wait()
    1.31 +                obj.wait()
    1.32              except Exception, e:
    1.33                  pass
    1.34  
    1.35 -            self.proc = None
    1.36 +            obj = None
    1.37 +    # _aux_stop
    1.38  
    1.39 -        if self.gmyth:
    1.40 -            try:
    1.41 -                os.kill(self.gmyth.pid, signal.SIGKILL)
    1.42 -            except OSError, e:
    1.43 -                pass
    1.44 -
    1.45 -            try:
    1.46 -                self.gmyth.wait()
    1.47 -            except Exception, e:
    1.48 -                pass
    1.49 -
    1.50 -            self.gmyth = None
    1.51 -
    1.52 +    def stop(self):
    1.53 +        self._aux_stop(self.proc)
    1.54 +        self._aux_stop(self.gmyth)
    1.55      # stop()
    1.56  
    1.57  # TranscoderMencoder