summaryrefslogtreecommitdiff
path: root/test/module/test.py
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-26 15:58:21 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-26 15:58:21 +0200
commit96e19464f98b868bd93b76ac842ec5b32a17cfb6 (patch)
treea232cfecd631d49fae8d1402371a284296aeec87 /test/module/test.py
parent28f4bd59314df8162548a1100b280bd256436eaa (diff)
means to run remote commands and get output
Diffstat (limited to 'test/module/test.py')
-rwxr-xr-xtest/module/test.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/module/test.py b/test/module/test.py
index a0b6493..9146c14 100755
--- a/test/module/test.py
+++ b/test/module/test.py
@@ -16,5 +16,34 @@ if __name__ == '__main__':
print('process command', cmd, payload)
return 'processed'
+ # print('defer sending a file...')
+ # gevent.sleep(1)
+ # return self.get_last_frame()
+
+ """
+ def get_last_frame(self):
+ if self.working:
+ self.working = False
+ return 'working'
+ path = os.getenv('TEST_FRAMES_PATH')
+ onlyfiles = sorted([f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))])
+ self.working = True
+
+ for f in onlyfiles:
+ gevent.sleep(1/10)
+ if not self.working:
+ return
+ output = BytesIO()
+ im = Image.open(os.path.join(path, f))
+ # im = im.convert('RGB')
+ im.save(output, format='JPEG')
+ frame = output.getvalue()
+ output.close()
+ self.send_frame(f.replace('png', 'jpg'), frame)
+
+ self.working = False
+ return 'ok'
+ """
+
# this will block
rpc = CortexRPC(get_params, set_param, ready, process_cmd)