gmyth-stream/server/0.2/plugins/transcoders/mencoder_lib/mythtv.py
branchtrunk
changeset 672 4e623a4274a1
parent 653 3433df0d6ae3
child 676 b51559fec601
     1.1 --- a/gmyth-stream/server/0.2/plugins/transcoders/mencoder_lib/mythtv.py	Tue May 15 18:25:19 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.2/plugins/transcoders/mencoder_lib/mythtv.py	Wed May 16 18:46:10 2007 +0100
     1.3 @@ -7,6 +7,43 @@
     1.4  
     1.5  from select import select
     1.6  
     1.7 +def _setup_mythfilename(self):
     1.8 +    # mythtv:mythtv@192.168.3.110:6543/1002_20070426230000.nuv
     1.9 +
    1.10 +    try:
    1.11 +        _mysql = self.args["input"].split("@")[0].split(":")
    1.12 +    except IndexError, e:
    1.13 +        _mysql = ["mythtv", "mythtv"]
    1.14 +
    1.15 +    self.log.debug("aqui 1")
    1.16 +
    1.17 +    _args = self.args["input"].split("@")[1].split(":")
    1.18 +    gmyth_dict = {}
    1.19 +    gmyth_dict["mysql"] = _mysql
    1.20 +    gmyth_dict["backend"] = _args[0]
    1.21 +    gmyth_dict["port"] = _args[1].split("/", 1)[0]
    1.22 +
    1.23 +    self.log.debug("aqui 2 %s" % _args)
    1.24 +
    1.25 +    _tmp_file = _args[1].split("/", 1)[1]
    1.26 +
    1.27 +    self.log.debug("aqui 2a %s" % _tmp_file)
    1.28 +
    1.29 +    if _tmp_file.find("channel") >= 0:
    1.30 +        gmyth_dict["kind"] = "c"
    1.31 +        gmyth_dict["cfile"] = _tmp_file.split("=")[1]
    1.32 +        self.log.debug("aqui 3")
    1.33 +    else:
    1.34 +        gmyth_dict["kind"] = "f"
    1.35 +        gmyth_dict["cfile"] = _tmp_file
    1.36 +        self.log.debug("aqui 4")
    1.37 +
    1.38 +    self.log.debug("aqui 5")
    1.39 +
    1.40 +    self.args["input"] = "-"
    1.41 +    return gmyth_dict
    1.42 +# _setup_mythfilename
    1.43 +
    1.44  def _setup_mythfile(err):
    1.45      size = err.read(20).split("\n")[0].split("Size:")[1]
    1.46      flags = fcntl.fcntl (err, fcntl.F_GETFL, 0) | os.O_NONBLOCK
    1.47 @@ -17,10 +54,10 @@
    1.48  def _setup_gmythcat(self):
    1.49      gmyth_cat = utils.which("gmyth-cat")
    1.50      return [ utils.which("gmyth-cat"),
    1.51 -            "-h", self.args["gmyth-cat"][0],
    1.52 -            "-p", self.args["gmyth-cat"][1],
    1.53 -            "-" + self.args["gmyth-cat"][2],
    1.54 -            self.args["gmyth-cat"][3]
    1.55 +            "-h", self.args["gmyth-cat"]["backend"],
    1.56 +            "-p", self.args["gmyth-cat"]["port"],
    1.57 +            "-" + self.args["gmyth-cat"]["kind"],
    1.58 +            self.args["gmyth-cat"]["cfile"]
    1.59             ]
    1.60  # _setup_gmythcat
    1.61  
    1.62 @@ -38,7 +75,7 @@
    1.63                                output=subprocess.PIPE):
    1.64          return False
    1.65  
    1.66 -    if self.args["gmyth-cat"][2] == "f":
    1.67 +    if self.args["gmyth-cat"]["kind"] == "f":
    1.68          try:
    1.69              size = _setup_mythfile(self.gmyth.stderr)
    1.70              self.log.debug("Size of file: %s" % size)