# HG changeset patch # User morphbr # Date 1179326538 -3600 # Node ID 464d715ddb7e15d2e8589efbfb51872366e15bf7 # Parent 338476853df39c47cd04a859a26b280b063a78bd [svn r670] * GMyth-Streamer - Updated mencoder uri schema diff -r 338476853df3 -r 464d715ddb7e gmyth-stream/server/0.2/plugins/transcoders/mencoder.py --- a/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py Wed May 16 13:35:11 2007 +0100 +++ b/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py Wed May 16 15:42:18 2007 +0100 @@ -36,9 +36,8 @@ self.args["outfile"] = params_first("outfile", "-") # input_opt - uri = params_first("uri", "file:-").split(":", 1) - self.args["type"] = uri[0] - self.args["input"] = uri[1] + self.args["type"] = params_first("type", "file") + self.args["input"] = params_first("uri", "-") # audio_opts self.args["acodec"] = params_first("acodec", "mp2") @@ -117,8 +116,16 @@ self._arg_append(args, "2>%s" % os.devnull) # _setup_args() + def _setup_filename(self): + """This function setups the file to encode parsing the uri. + So, type can be: + * file + * dvd + * myth - def _setup_filename(self): + If the last one is detected we have to parse the uri to find args. + Then we store all the args inside a dictionary: self.args['gmyth-cat'] + """ _type = self.args["type"] if _type == "file": @@ -132,11 +139,7 @@ self.args["input"] = "dvd://".join(self.args["input"]) elif _type == "myth": - # gmyth-cat -h 192.168.1.124 -p 6543 -c 111 - # gmyth-cat -h 192.168.1.124 -p 6543 -f file.nuv - # myth://IP:PORT:type:file - self.args["gmyth-cat"] = self.args["input"].split(":") - self.args["input"] = "-" + self.args["gmyth-cat"] = mythtv._setup_mythfilename(self) # _setup_filename() diff -r 338476853df3 -r 464d715ddb7e gmyth-stream/server/0.2/plugins/transcoders/mencoder_lib/mythtv.py --- a/gmyth-stream/server/0.2/plugins/transcoders/mencoder_lib/mythtv.py Wed May 16 13:35:11 2007 +0100 +++ b/gmyth-stream/server/0.2/plugins/transcoders/mencoder_lib/mythtv.py Wed May 16 15:42:18 2007 +0100 @@ -7,6 +7,43 @@ from select import select +def _setup_mythfilename(self): + # mythtv:mythtv@192.168.3.110:6543/1002_20070426230000.nuv + + try: + _mysql = self.args["input"].split("@")[0].split(":") + except IndexError, e: + _mysql = ["mythtv", "mythtv"] + + self.log.debug("aqui 1") + + _args = self.args["input"].split("@")[1].split(":") + gmyth_dict = {} + gmyth_dict["mysql"] = _mysql + gmyth_dict["backend"] = _args[0] + gmyth_dict["port"] = _args[1].split("/", 1)[0] + + self.log.debug("aqui 2 %s" % _args) + + _tmp_file = _args[1].split("/", 1)[1] + + self.log.debug("aqui 2a %s" % _tmp_file) + + if _tmp_file.find("channel") >= 0: + gmyth_dict["kind"] = "c" + gmyth_dict["cfile"] = _tmp_file.split("=")[1] + self.log.debug("aqui 3") + else: + gmyth_dict["kind"] = "f" + gmyth_dict["cfile"] = _tmp_file + self.log.debug("aqui 4") + + self.log.debug("aqui 5") + + self.args["input"] = "-" + return gmyth_dict +# _setup_mythfilename + def _setup_mythfile(err): size = err.read(20).split("\n")[0].split("Size:")[1] flags = fcntl.fcntl (err, fcntl.F_GETFL, 0) | os.O_NONBLOCK @@ -17,10 +54,10 @@ def _setup_gmythcat(self): gmyth_cat = utils.which("gmyth-cat") return [ utils.which("gmyth-cat"), - "-h", self.args["gmyth-cat"][0], - "-p", self.args["gmyth-cat"][1], - "-" + self.args["gmyth-cat"][2], - self.args["gmyth-cat"][3] + "-h", self.args["gmyth-cat"]["backend"], + "-p", self.args["gmyth-cat"]["port"], + "-" + self.args["gmyth-cat"]["kind"], + self.args["gmyth-cat"]["cfile"] ] # _setup_gmythcat @@ -38,7 +75,7 @@ output=subprocess.PIPE): return False - if self.args["gmyth-cat"][2] == "f": + if self.args["gmyth-cat"]["kind"] == "f": try: size = _setup_mythfile(self.gmyth.stderr) self.log.debug("Size of file: %s" % size)