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 }
def __init__(self, server): driverNull.__init__(self) # ALWAYS RESOLVE DNS NAMES TO IP or ROku will not respond! self.server = "http://" + self.FQDN2IP(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("pause", CommandType.PLAYBACK_PAUSE, self.playbackPause) self.addCommand("stop", CommandType.PLAYBACK_STOP, self.playbackStop) 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) self.addCommand("subtitle", CommandType.PLAYBACK_SUBTITLE, self.playbackSubtitle) self.addCommand("audio", CommandType.PLAYBACK_AUDIO, self.playbackAudio)
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)
def __init__(self, server, macaddress=None, iface="eth0"): driverNull.__init__(self) self.server = "http://" + server + ":5000" 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("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.playbackForward) self.addCommand("-10s", CommandType.PLAYBACK_SKIP_BACKWARD, self.playbackBackward) self.addCommand("next chapter", CommandType.PLAYBACK_CNEXT, self.playbackNext) self.addCommand("previous chapter", CommandType.PLAYBACK_CPREVIOUS, self.playbackPrev) self.addCommand("subtitle", CommandType.PLAYBACK_SUBTITLE, self.playbackSubtitle) self.addCommand("audio", CommandType.PLAYBACK_AUDIO, self.playbackAudio)
def __init__(self, server, commandfile): driverNull.__init__(self) self.server = server self.cmd_on = None self.cmd_off = None self.cooldown = 0 self.cmdfile = commandfile jdata = open(commandfile) data = json.load(jdata) if data['file'].startswith('/'): jdata = open(data["file"]) else: path = os.path.dirname(commandfile) jdata = open(os.path.join(path, 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
def __init__(self): driverNull.__init__(self)