diff --git a/POCloud/poc.py b/POCloud/poc.py index 2f8038e..0202029 100644 --- a/POCloud/poc.py +++ b/POCloud/poc.py @@ -449,7 +449,6 @@ class start(threading.Thread, deviceBase): global API_BASE_URL try: url = API_BASE_URL + '/api/cards?q={"order_by":[{"field":"created_on","direction":"desc"}], "limit":' + str(numCards) + "}" - print(url) api_req = requests.get(url, verify=False) req_data = json.loads(api_req.text)['objects'] @@ -478,10 +477,10 @@ class start(threading.Thread, deviceBase): self.sendtodb("cardtype", current_card['stroke_type'], int(timestamp)) # TODO: FIX CARD PARSING - s_p = current_card["surf_pos"] - s_l = current_card["surf_lod"] - d_p = current_card["down_pos"] - d_l = current_card["down_lod"] + s_p = current_card["surf_pos"].replace("[", "").replace("]", "").split(", ") + s_l = current_card["surf_lod"].replace("[", "").replace("]", "").split(", ") + d_p = current_card["down_pos"].replace("[", "").replace("]", "").split(", ") + d_l = current_card["down_lod"].replace("[", "").replace("]", "").split(", ") newSc = "[" newDc = "[" @@ -490,7 +489,7 @@ class start(threading.Thread, deviceBase): if s_p[i] is None: continue if s_p[i] != 0.0 and s_l[i] != 0.0: - newSc += "[" + str(round(s_p[i],3)) + ", " + str(round(s_l[i],3)) + "], " + newSc += "[" + str(round(float(s_p[i]), 3)) + ", " + str(round(float(s_l[i]), 3)) + "], " except: pass newSc += "]" @@ -500,11 +499,14 @@ class start(threading.Thread, deviceBase): if d_p[i] is None: continue if d_p[i] != 0.0 and d_l[i] != 0.0: - newDc += "[" + str(round(d_p[i], 3)) + ", " + str(round(d_l[i], 3)) + "], " + newDc += "[" + str(round(float(d_p[i]), 3)) + ", " + str(round(float(d_l[i]), 3)) + "], " except: pass newDc += "]" - + self.sendtodb("surf_pos", current_card["surf_pos"], card_timestamp) + self.sendtodb("surf_lod", current_card["surf_lod"], card_timestamp) + self.sendtodb("down_pos", current_card["down_pos"], card_timestamp) + self.sendtodb("down_lod", current_card["down_lod"], card_timestamp) self.sendtodb("sc", newSc, card_timestamp) self.sendtodb("dc", newDc, card_timestamp)