# HG changeset patch # User morphbr # Date 1175706344 -3600 # Node ID 7a0c3906dce2c8572783c41f14e00ffdadae62ce # Parent 08a2d7d67ae55e24ce8d27c67a5158c3773f9dcd [svn r503] GMyth-Streamer: Chenca's bug fix diff -r 08a2d7d67ae5 -r 7a0c3906dce2 gmyth-stream/server/main.py --- a/gmyth-stream/server/main.py Wed Apr 04 17:08:11 2007 +0100 +++ b/gmyth-stream/server/main.py Wed Apr 04 18:05:44 2007 +0100 @@ -21,7 +21,7 @@ lib.log("Starting GMyth-Stream server") -while (server.finish is 0): +while (server.finish == 0): con, client = server.getRequest() while True: @@ -31,7 +31,7 @@ lib.log("Received %s from: %s" % (msg, client) ) - if msg is "SETUP": + if msg == "SETUP": setup = server.getMsg(1024).strip().split(" ") size = len(setup) options = [] @@ -52,21 +52,21 @@ setup[6], setup[7], setup[8], setup[9], options) - if ret is 0: + if ret == 0: server.Ack("SETUP") else: server.sendMsg(lib.log(ret)) - elif msg is "PLAY": + elif msg == "PLAY": media.play() server.Ack("PLAY") - elif msg is "STOP": + elif msg == "STOP": media.stop() server.Ack("STOP") - elif msg is "CLOSE": + elif msg == "CLOSE": server.finish = 1 media.stop() server.Ack("CLOSE") diff -r 08a2d7d67ae5 -r 7a0c3906dce2 gmyth-stream/server/plugins/media/mencoder.py --- a/gmyth-stream/server/plugins/media/mencoder.py Wed Apr 04 17:08:11 2007 +0100 +++ b/gmyth-stream/server/plugins/media/mencoder.py Wed Apr 04 18:05:44 2007 +0100 @@ -33,16 +33,16 @@ for opt in options: - if opt is "file" or opt is "dvd": + if opt == "file" or opt == "dvd": - if self.acodec is "mp3lame": + if self.acodec == "mp3lame": audio = "-oac mp3lame -lameopts cbr:br=%s vol=5" % self.abitrate else: audio = "-oac lavc -lavcopts acodec=%s:abitrate=%s" % (\ self.acodec, self.abitrate) - if opt is "file": + if opt == "file": self.kind = "file" self.args += " %s -mf fps=%s -of %s %s"\ " -ovc lavc -lavcopts vcodec=%s:vbitrate=%s -vf scale=%s:%s"\ @@ -50,7 +50,7 @@ self.filename, self.fps, self.mux, audio, self.vcodec, self.vbitrate, self.width, self.height, self.fifo) - elif opt is "dvd": + elif opt == "dvd": self.kind = "dvd" self.args += " dvd://%s -alang %s -vf scale=%s:%s %s"\ " -of %s -ovc lavc -lavcopts vcodec=%s:vbitrate=%s -o %s"\ @@ -58,7 +58,7 @@ self.filename, self.language, self.width, self.height, audio, self.mux, self.vcodec, self.vbitrate, self.fifo, self.fps) - elif opt is "local": + elif opt == "local": self.mplayer = os.popen("which mplayer").read().strip() elif opt.find("language=") >= 0: @@ -77,7 +77,7 @@ def run_mplayer(self): msg = "%s 1>/dev/null 2>/dev/null" % self.filename - if self.kind is "dvd": + if self.kind == "dvd": msg = "dvd://" + msg self.mplayer += " " + msg @@ -103,16 +103,16 @@ self.kind = "" self.set_args(options) - if self.kind is "file" and not os.path.exists(self.filename): + if self.kind == "file" and not os.path.exists(self.filename): msg = "File requested does not exist. SETUP failed." lib.log(msg) return msg - # good one: /tmp/dvb.mpg avi mpeg4 400 25 mp3lame 192 320 240 5000 + # good one: /tmp/dvb.mpg avi mpeg4 400 25 mp3lame 192 320 240 5000 file #4 mpeg mpeg1video 400 25 mp3lame 192 400 240 5000 language=en local dvd self.path = self.config.get("Mencoder", "path") - if self.socket is not None: + if self.socket != None: del(self.socket) self.socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) @@ -138,7 +138,7 @@ self.child_pid = os.fork() - if self.child_pid is 0: + if self.child_pid == 0: conn,addr= self.socket.accept() lib.log("Sending Data to client: %s" % addr[0]) @@ -146,13 +146,13 @@ conn.settimeout(5) retry = 0 - while data is not "" and retry < 5: + while data != "" and retry < 5: try: conn.send(data) r, w, x = select([conn], [], [], 0) if conn in r: back = conn.recv(1024) - if back is "OK" and self.mplayer and not self.mplayer_pid: + if back == "OK" and self.mplayer and not self.mplayer_pid: self.run_mplayer() except socket.error: @@ -176,10 +176,10 @@ except: lib.log("Trying to stop before playing...") - if self.socket is not None: + if self.socket != None: lib.log("Closing socket") self.socket.close() lib.log("Trying to stop Mencoder process") - if self.child_pid is not None: + if self.child_pid != None: os.kill(self.child_pid, signal.SIGABRT)