diff options
Diffstat (limited to 'rpc/rpc.py')
| -rw-r--r-- | rpc/rpc.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -13,7 +13,7 @@ class CortexRPC(object): def __init__(self, fn): super().__init__() self._listener = fn - self.fetching = False + self.working = False self.connect() def connect(self): @@ -40,14 +40,17 @@ class CortexRPC(object): # return self.get_last_frame() def get_last_frame(self): - if self.fetching: + 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.fetching = True + 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') @@ -56,7 +59,7 @@ class CortexRPC(object): output.close() self.send_frame(f.replace('png', 'jpg'), frame) - self.fetching = False + self.working = False return "ok" def send_param(self, key, value): |
