1.1 --- a/gmyth-stream/server/plugins/media/mencoder.py Wed Apr 04 17:08:11 2007 +0100
1.2 +++ b/gmyth-stream/server/plugins/media/mencoder.py Wed Apr 04 18:05:44 2007 +0100
1.3 @@ -33,16 +33,16 @@
1.4
1.5 for opt in options:
1.6
1.7 - if opt is "file" or opt is "dvd":
1.8 + if opt == "file" or opt == "dvd":
1.9
1.10 - if self.acodec is "mp3lame":
1.11 + if self.acodec == "mp3lame":
1.12 audio = "-oac mp3lame -lameopts cbr:br=%s vol=5" % self.abitrate
1.13 else:
1.14 audio = "-oac lavc -lavcopts acodec=%s:abitrate=%s" % (\
1.15 self.acodec, self.abitrate)
1.16
1.17
1.18 - if opt is "file":
1.19 + if opt == "file":
1.20 self.kind = "file"
1.21 self.args += " %s -mf fps=%s -of %s %s"\
1.22 " -ovc lavc -lavcopts vcodec=%s:vbitrate=%s -vf scale=%s:%s"\
1.23 @@ -50,7 +50,7 @@
1.24 self.filename, self.fps, self.mux, audio, self.vcodec,
1.25 self.vbitrate, self.width, self.height, self.fifo)
1.26
1.27 - elif opt is "dvd":
1.28 + elif opt == "dvd":
1.29 self.kind = "dvd"
1.30 self.args += " dvd://%s -alang %s -vf scale=%s:%s %s"\
1.31 " -of %s -ovc lavc -lavcopts vcodec=%s:vbitrate=%s -o %s"\
1.32 @@ -58,7 +58,7 @@
1.33 self.filename, self.language, self.width, self.height, audio,
1.34 self.mux, self.vcodec, self.vbitrate, self.fifo, self.fps)
1.35
1.36 - elif opt is "local":
1.37 + elif opt == "local":
1.38 self.mplayer = os.popen("which mplayer").read().strip()
1.39
1.40 elif opt.find("language=") >= 0:
1.41 @@ -77,7 +77,7 @@
1.42 def run_mplayer(self):
1.43 msg = "%s 1>/dev/null 2>/dev/null" % self.filename
1.44
1.45 - if self.kind is "dvd":
1.46 + if self.kind == "dvd":
1.47 msg = "dvd://" + msg
1.48
1.49 self.mplayer += " " + msg
1.50 @@ -103,16 +103,16 @@
1.51 self.kind = ""
1.52 self.set_args(options)
1.53
1.54 - if self.kind is "file" and not os.path.exists(self.filename):
1.55 + if self.kind == "file" and not os.path.exists(self.filename):
1.56 msg = "File requested does not exist. SETUP failed."
1.57 lib.log(msg)
1.58 return msg
1.59
1.60 - # good one: /tmp/dvb.mpg avi mpeg4 400 25 mp3lame 192 320 240 5000
1.61 + # good one: /tmp/dvb.mpg avi mpeg4 400 25 mp3lame 192 320 240 5000 file
1.62 #4 mpeg mpeg1video 400 25 mp3lame 192 400 240 5000 language=en local dvd
1.63 self.path = self.config.get("Mencoder", "path")
1.64
1.65 - if self.socket is not None:
1.66 + if self.socket != None:
1.67 del(self.socket)
1.68
1.69 self.socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
1.70 @@ -138,7 +138,7 @@
1.71
1.72 self.child_pid = os.fork()
1.73
1.74 - if self.child_pid is 0:
1.75 + if self.child_pid == 0:
1.76 conn,addr= self.socket.accept()
1.77 lib.log("Sending Data to client: %s" % addr[0])
1.78
1.79 @@ -146,13 +146,13 @@
1.80 conn.settimeout(5)
1.81 retry = 0
1.82
1.83 - while data is not "" and retry < 5:
1.84 + while data != "" and retry < 5:
1.85 try:
1.86 conn.send(data)
1.87 r, w, x = select([conn], [], [], 0)
1.88 if conn in r:
1.89 back = conn.recv(1024)
1.90 - if back is "OK" and self.mplayer and not self.mplayer_pid:
1.91 + if back == "OK" and self.mplayer and not self.mplayer_pid:
1.92 self.run_mplayer()
1.93
1.94 except socket.error:
1.95 @@ -176,10 +176,10 @@
1.96 except:
1.97 lib.log("Trying to stop before playing...")
1.98
1.99 - if self.socket is not None:
1.100 + if self.socket != None:
1.101 lib.log("Closing socket")
1.102 self.socket.close()
1.103
1.104 lib.log("Trying to stop Mencoder process")
1.105 - if self.child_pid is not None:
1.106 + if self.child_pid != None:
1.107 os.kill(self.child_pid, signal.SIGABRT)