예제 #1
0
def run():
    for i in range(5):
        filename = os.path.dirname(
            os.path.abspath(__file__)) + "/../data/color_map.png"
        splash.set_global("replaceObject", ["image", "image", "object"])
        splash.set_object("image", "file", filename)
        sleep(1.0)
        splash.set_global("replaceObject", ["image", "image_ffmpeg", "object"])
        sleep(1.0)
예제 #2
0
def run():
    splash.set_global("replaceObject", ["image", "image_v4l2", "object"])
    splash.set_object("image", "doCapture", 1)
    sleep(1.0)
    splash.set_object("image", "captureSize", [2048, 2048])
    sleep(1.0)
    splash.set_object("image", "captureSize", [640, 480])
    sleep(1.0)
    splash.set_object("image", "doCapture", 0)
예제 #3
0
def run():
    splash.set_global("replaceObject", ["image", "image_v4l2", "object"])
    splash.set_object("image", "doCapture", 1)
    sleep(1.0)
    splash.set_object("image", "captureSize", [2048, 2048])
    sleep(1.0)
    splash.set_object("image", "captureSize", [640, 480])
    sleep(1.0)
    splash.set_object("image", "doCapture", 0)
예제 #4
0
    def do_GET(self):
        match = reg.findall(self.path)[0]
        command = match[0]

        if match[0] == "getObjectList":
            result = splash.get_object_list()
            self.sendResult(result)
        elif match[0] == "getObjectTypes":
            result = splash.get_object_types()
            self.sendResult(result)
        elif match[0] == "getObjectAttributeDescription":
            obj = match[1]
            attr = match[2]
            result = splash.get_object_attribute_description(obj, attr)
            self.sendResult(result)
        elif match[0] == "getObjectAttribute":
            obj = match[1]
            attr = match[2]
            result = splash.get_object_attribute(obj, attr)
            self.sendResult(result)
        elif match[0] == "getObjectLinks":
            result = splash.get_object_links()
            self.sendResult(result)
        elif match[0] == "setObject":
            obj = match[1]
            attr = match[2]
            value = match[3].split("&")
            for i in range(len(value)):
                converted = False
                try:
                    value[i] = int(value[i])
                    converted = True
                except:
                    pass

                if not converted:
                    try:
                        value[i] = float(value[i])
                    except:
                        pass

            if splash.set_object(obj, attr, value):
                self.sendResult("OK")
            else:
                self.sendResult("")
예제 #5
0
    def do_GET(self):
        match = reg.findall(self.path)[0]
        command = match[0]

        if match[0] == "getObjectList":
            result = splash.get_object_list()
            self.sendResult(result)
        elif match[0] == "getObjectTypes":
            result = splash.get_object_types()
            self.sendResult(result)
        elif match[0] == "getObjectAttributeDescription":
            obj = match[1]
            attr = match[2]
            result = splash.get_object_attribute_description(obj, attr)
            self.sendResult(result)
        elif match[0] == "getObjectAttribute":
            obj = match[1]
            attr = match[2]
            result = splash.get_object_attribute(obj, attr)
            self.sendResult(result)
        elif match[0] == "getObjectLinks":
            result = splash.get_object_links()
            self.sendResult(result)
        elif match[0] == "setObject":
            obj = match[1]
            attr = match[2]
            value = match[3].split('&')
            for i in range(len(value)):
                converted = False
                try:
                    value[i] = int(value[i])
                    converted = True
                except:
                    pass

                if not converted:
                    try:
                        value[i] = float(value[i])
                    except:
                        pass

            if splash.set_object(obj, attr, value):
                self.sendResult("OK")
            else:
                self.sendResult("")