diff options
| -rw-r--r-- | app/server/index.js | 1 | ||||
| -rw-r--r-- | rpc/rpc.py | 22 |
2 files changed, 7 insertions, 16 deletions
diff --git a/app/server/index.js b/app/server/index.js index 429cbb1..2ef1322 100644 --- a/app/server/index.js +++ b/app/server/index.js @@ -3,7 +3,6 @@ const express = require('express') const app = express() const http = require('http') const socket_io = require('socket.io') -const ss = require('socket.io-stream') app.use(express.static('public', { extensions: ['html'] })) @@ -13,6 +13,7 @@ class CortexRPC(object): def __init__(self, fn): super().__init__() self._listener = fn + self.fetching = False self.connect() def connect(self): @@ -39,25 +40,16 @@ class CortexRPC(object): # return self.get_last_frame() def get_last_frame(self): - # self.send_frame("test.png", '01234567' * 8 * 8 * 8 * 8 * 2) - from os import listdir - from os.path import isfile, join - path = '/Users/user/Desktop/woods_videos/test_clahe_brightness_posterize_256/' - onlyfiles = sorted([f for f in listdir(path) if isfile(join(path, f))]) - - # im = Image.open(join(path, onlyfiles[0])) - # for f in onlyfiles: - # gevent.sleep(1/29) - # output = BytesIO() - # im.save(output, format="JPEG") - # frame = base64.b64encode(output.getvalue()) - # output.close() - # self.send_frame(f, frame) + if self.fetching: + 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.fetching = True for f in onlyfiles: gevent.sleep(1/30) output = BytesIO() - im = Image.open(join(path, f)) + im = Image.open(os.path.join(path, f)) # im = im.convert('RGB') im.save(output, format="JPEG") frame = output.getvalue() |
