예제 #1
0
  def __init__(self, server, commandfile):
    DriverNull.__init__(self)

    self.code_on = "on"
    self.code_off = "off"
    self.server = server
    self.file = commandfile

    jdata = open(commandfile)
    self.ircmds = json.load(jdata)
    if not "on" in self.ircmds:
      logging.debug("Using toggle for %s instead of discreet on/off" % commandfile)
      code_on = code_off = "toggle"

    """
    By default, this driver will prefill the commandlist with PRIVATE_UNDEFINED, this way
    a driver based on this can easily fill in the gaps.
    """
    for cmd in self.ircmds:
      if cmd == "on" or cmd == "off" or cmd == "toggle":
        continue
      self.COMMAND_HANDLER[cmd] = {
        "arguments"   : 0,
        "handler"     : self.sendCommand, "extras" : cmd,
        "name"        : "Undefined",
        "description" : "Undefined",
        "type"        : CommandType.PRIVATE_UNDEFINED
      }
예제 #2
0
  def __init__(self, server, commandfile):
    DriverNull.__init__(self)

    self.server = server
    self.cmd_on = None
    self.cmd_off = None

    jdata = open(commandfile)
    data = json.load(jdata)

    jdata = open(data["file"])
    self.ircmds = json.load(jdata)

    for cmd in data["commands"]:
      self.COMMAND_HANDLER[cmd] = {
        "arguments"   : 0,
        "handler"     : self.sendCommand,
        "extras"      : cmd,
        "name"        : cmd,
        "description" : cmd,
        "type"        : data["commands"][cmd]["type"]
      }
      if "sequence" in data["commands"][cmd]:
        self.COMMAND_HANDLER[cmd]["extras"] = data["commands"][cmd]["sequence"]
      if "name" in data["commands"][cmd]:
        self.COMMAND_HANDLER[cmd]["name"] = data["commands"][cmd]["name"]
      if "description" in data["commands"][cmd]:
        self.COMMAND_HANDLER[cmd]["description"] =  data["commands"][cmd]["description"]
      if data["commands"][cmd]["type"] == 901:
        self.cmd_on = cmd
      if data["commands"][cmd]["type"] == 902:
        self.cmd_off = cmd
예제 #3
0
  def __init__(self, server, macaddress = None, iface = "eth0"):
    DriverNull.__init__(self)

    self.urlPlayback = "/player/playback/"
    self.urlNavigate = "/player/navigation/"
    self.urlApp = "/player/application/"

    self.server = "http://" + server + ":3005"
    self.mac = macaddress
    self.iface = iface

    self.addCommand("up",     CommandType.NAVIGATE_UP,      self.navUp)
    self.addCommand("down",   CommandType.NAVIGATE_DOWN,    self.navDown)
    self.addCommand("left",   CommandType.NAVIGATE_LEFT,    self.navLeft)
    self.addCommand("right",  CommandType.NAVIGATE_RIGHT,   self.navRight)
    self.addCommand("enter",  CommandType.NAVIGATE_ENTER,   self.navEnter)
    self.addCommand("back",   CommandType.NAVIGATE_BACK,    self.navBack)
    self.addCommand("home",   CommandType.NAVIGATE_HOME,    self.navHome)

    self.addCommand("play",   CommandType.PLAYBACK_PLAY,    self.playbackPlay)
    self.addCommand("pause",  CommandType.PLAYBACK_PAUSE,   self.playbackPause)
    self.addCommand("stop",   CommandType.PLAYBACK_STOP,    self.playbackStop)

    self.addCommand("+30s",   CommandType.PLAYBACK_SKIP_FORWARD,   self.playbackSkip, None, None, "stepForward")
    self.addCommand("-15s",   CommandType.PLAYBACK_SKIP_BACKWARD,  self.playbackSkip, None, None, "stepBack")

    self.addCommand("text",   CommandType.NAVIGATE_TEXTINPUT,     self.navTextInput, None, None, None, 1)
예제 #4
0
  def __init__(self, server):
    DriverNull.__init__(self)

    self.server = "http://" + server + ":8060/"
    self.home = None

    self.addCommand("up",     CommandType.NAVIGATE_UP,      self.navUp)
    self.addCommand("down",   CommandType.NAVIGATE_DOWN,    self.navDown)
    self.addCommand("left",   CommandType.NAVIGATE_LEFT,    self.navLeft)
    self.addCommand("right",  CommandType.NAVIGATE_RIGHT,   self.navRight)
    self.addCommand("select", CommandType.NAVIGATE_ENTER,   self.navEnter)
    self.addCommand("back",   CommandType.NAVIGATE_BACK,    self.navBack)
    self.addCommand("home",   CommandType.NAVIGATE_HOME,    self.navHome)

    self.addCommand("info",     CommandType.PLAYBACK_OSD,           self.playbackInfo)
    self.addCommand("play",     CommandType.PLAYBACK_PLAY,          self.playbackPlay)
    self.addCommand("rewind",   CommandType.PLAYBACK_REWIND,        self.playbackRW)
    self.addCommand("forward",  CommandType.PLAYBACK_FASTFORWARD,   self.playbackFF)

    self.addCommand("text",     CommandType.NAVIGATE_TEXTINPUT,     self.navTextInput, None, None, None, 1)