From a23a91808ec8062ec2f5481ce844cc679d55d546 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 20 May 2018 18:38:11 +0200 Subject: no stream --- rpc/rpc.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'rpc') diff --git a/rpc/rpc.py b/rpc/rpc.py index c9eebc2..4e87263 100644 --- a/rpc/rpc.py +++ b/rpc/rpc.py @@ -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() -- cgit v1.2.3-70-g09d2