diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-20 18:38:11 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-20 18:38:11 +0200 |
| commit | a23a91808ec8062ec2f5481ce844cc679d55d546 (patch) | |
| tree | 32083a99294a99c754ff6f8d31ecc8a53cd9aae8 /rpc/rpc.py | |
| parent | 4577f906c2abc6cbb09a2265da70afc93acc1846 (diff) | |
no stream
Diffstat (limited to 'rpc/rpc.py')
| -rw-r--r-- | rpc/rpc.py | 22 |
1 files changed, 7 insertions, 15 deletions
@@ -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() |
