1.1 --- a/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py Wed May 16 13:35:11 2007 +0100
1.2 +++ b/gmyth-stream/server/0.2/plugins/transcoders/mencoder.py Wed May 16 15:42:18 2007 +0100
1.3 @@ -36,9 +36,8 @@
1.4 self.args["outfile"] = params_first("outfile", "-")
1.5
1.6 # input_opt
1.7 - uri = params_first("uri", "file:-").split(":", 1)
1.8 - self.args["type"] = uri[0]
1.9 - self.args["input"] = uri[1]
1.10 + self.args["type"] = params_first("type", "file")
1.11 + self.args["input"] = params_first("uri", "-")
1.12
1.13 # audio_opts
1.14 self.args["acodec"] = params_first("acodec", "mp2")
1.15 @@ -117,8 +116,16 @@
1.16 self._arg_append(args, "2>%s" % os.devnull)
1.17 # _setup_args()
1.18
1.19 + def _setup_filename(self):
1.20 + """This function setups the file to encode parsing the uri.
1.21 + So, type can be:
1.22 + * file
1.23 + * dvd
1.24 + * myth
1.25
1.26 - def _setup_filename(self):
1.27 + If the last one is detected we have to parse the uri to find args.
1.28 + Then we store all the args inside a dictionary: self.args['gmyth-cat']
1.29 + """
1.30 _type = self.args["type"]
1.31
1.32 if _type == "file":
1.33 @@ -132,11 +139,7 @@
1.34 self.args["input"] = "dvd://".join(self.args["input"])
1.35
1.36 elif _type == "myth":
1.37 - # gmyth-cat -h 192.168.1.124 -p 6543 -c 111
1.38 - # gmyth-cat -h 192.168.1.124 -p 6543 -f file.nuv
1.39 - # myth://IP:PORT:type:file
1.40 - self.args["gmyth-cat"] = self.args["input"].split(":")
1.41 - self.args["input"] = "-"
1.42 + self.args["gmyth-cat"] = mythtv._setup_mythfilename(self)
1.43 # _setup_filename()
1.44
1.45
2.1 --- a/gmyth-stream/server/0.2/plugins/transcoders/mencoder_lib/mythtv.py Wed May 16 13:35:11 2007 +0100
2.2 +++ b/gmyth-stream/server/0.2/plugins/transcoders/mencoder_lib/mythtv.py Wed May 16 15:42:18 2007 +0100
2.3 @@ -7,6 +7,43 @@
2.4
2.5 from select import select
2.6
2.7 +def _setup_mythfilename(self):
2.8 + # mythtv:mythtv@192.168.3.110:6543/1002_20070426230000.nuv
2.9 +
2.10 + try:
2.11 + _mysql = self.args["input"].split("@")[0].split(":")
2.12 + except IndexError, e:
2.13 + _mysql = ["mythtv", "mythtv"]
2.14 +
2.15 + self.log.debug("aqui 1")
2.16 +
2.17 + _args = self.args["input"].split("@")[1].split(":")
2.18 + gmyth_dict = {}
2.19 + gmyth_dict["mysql"] = _mysql
2.20 + gmyth_dict["backend"] = _args[0]
2.21 + gmyth_dict["port"] = _args[1].split("/", 1)[0]
2.22 +
2.23 + self.log.debug("aqui 2 %s" % _args)
2.24 +
2.25 + _tmp_file = _args[1].split("/", 1)[1]
2.26 +
2.27 + self.log.debug("aqui 2a %s" % _tmp_file)
2.28 +
2.29 + if _tmp_file.find("channel") >= 0:
2.30 + gmyth_dict["kind"] = "c"
2.31 + gmyth_dict["cfile"] = _tmp_file.split("=")[1]
2.32 + self.log.debug("aqui 3")
2.33 + else:
2.34 + gmyth_dict["kind"] = "f"
2.35 + gmyth_dict["cfile"] = _tmp_file
2.36 + self.log.debug("aqui 4")
2.37 +
2.38 + self.log.debug("aqui 5")
2.39 +
2.40 + self.args["input"] = "-"
2.41 + return gmyth_dict
2.42 +# _setup_mythfilename
2.43 +
2.44 def _setup_mythfile(err):
2.45 size = err.read(20).split("\n")[0].split("Size:")[1]
2.46 flags = fcntl.fcntl (err, fcntl.F_GETFL, 0) | os.O_NONBLOCK
2.47 @@ -17,10 +54,10 @@
2.48 def _setup_gmythcat(self):
2.49 gmyth_cat = utils.which("gmyth-cat")
2.50 return [ utils.which("gmyth-cat"),
2.51 - "-h", self.args["gmyth-cat"][0],
2.52 - "-p", self.args["gmyth-cat"][1],
2.53 - "-" + self.args["gmyth-cat"][2],
2.54 - self.args["gmyth-cat"][3]
2.55 + "-h", self.args["gmyth-cat"]["backend"],
2.56 + "-p", self.args["gmyth-cat"]["port"],
2.57 + "-" + self.args["gmyth-cat"]["kind"],
2.58 + self.args["gmyth-cat"]["cfile"]
2.59 ]
2.60 # _setup_gmythcat
2.61
2.62 @@ -38,7 +75,7 @@
2.63 output=subprocess.PIPE):
2.64 return False
2.65
2.66 - if self.args["gmyth-cat"][2] == "f":
2.67 + if self.args["gmyth-cat"]["kind"] == "f":
2.68 try:
2.69 size = _setup_mythfile(self.gmyth.stderr)
2.70 self.log.debug("Size of file: %s" % size)