Make cable_search match cable_map
This commit is contained in:
parent
2296aea463
commit
1e01141f41
@ -721,12 +721,12 @@ if __name__ == "__main__":
|
||||
import matplotlib.pyplot as plt
|
||||
ledsys = LEDSystem()
|
||||
ledsys.init()
|
||||
cap = cv2.VideoCapture('badapple.mp4')
|
||||
cap = cv2.VideoCapture('output.mp4')
|
||||
while cap.isOpened():
|
||||
ret, frame = cap.read()
|
||||
if not ret:
|
||||
break
|
||||
ledsys.mapimage(frame, fps=60)
|
||||
ledsys.mapimage(frame, fps=200)
|
||||
|
||||
show = False
|
||||
ring = 1
|
||||
|
BIN
map.png
BIN
map.png
Binary file not shown.
Before Width: | Height: | Size: 340 KiB After Width: | Height: | Size: 340 KiB |
47
run.py
47
run.py
@ -249,10 +249,51 @@ def check_server():
|
||||
elif call == "request":
|
||||
results = jbs.search(data["string"])["hits"]
|
||||
dataout = dict()
|
||||
dataout["cables"] = list()
|
||||
for result in results:
|
||||
dataout["cables"].append(result["fullspecs"])
|
||||
dataout["map"] = list()
|
||||
for cabledata in results:
|
||||
|
||||
fs = cabledata["fullspecs"]
|
||||
tmp1 = {"part_number": cable_list[idx], "position": idx, "name": cable_list[idx], "brand": cabledata["brand"] }
|
||||
if "Product Overview" in fs and "Product Category" in fs["Product Overview"]:
|
||||
tmp1["category"] = fs["Product Overview"]["Product Category"]
|
||||
if "Product Overview" in fs and "Suitable Applications" in fs["Product Overview"]:
|
||||
if len(fs["Product Overview"]["Suitable Applications"]) == 0 or not isinstance(fs["Product Overview"]["Suitable Applications"], str):
|
||||
print(cable_list[idx], fs["Product Overview"]["Suitable Applications"])
|
||||
for key, value in fs["Product Overview"].items():
|
||||
#print(key,value)
|
||||
if len(value) > 5 and isinstance(value, str):
|
||||
tmp1["application"] = value
|
||||
elif len(key) > 15 and not isinstance(value, str):
|
||||
tmp1["application"] = key
|
||||
else:
|
||||
tmp1["application"] = fs["Product Overview"]["Suitable Applications"]
|
||||
elif "Product Overview" in fs and "Suitable Applications:" in fs["Product Overview"]:
|
||||
if len(fs["Product Overview"]["Suitable Applications:"]) == 0 or not isinstance(fs["Product Overview"]["Suitable Applications:"], str):
|
||||
print(cable_list[idx], fs["Product Overview"]["Suitable Applications:"])
|
||||
for key, value in fs["Product Overview"].items():
|
||||
#print(key,value)
|
||||
if len(value) > 5 and isinstance(value, str):
|
||||
tmp1["application"] = value
|
||||
elif len(key) > 15 and not isinstance(value, str):
|
||||
tmp1["application"] = key
|
||||
else:
|
||||
tmp1["application"] = fs["Product Overview"]["Suitable Applications:"]
|
||||
if "image" in cabledata:
|
||||
tmp1["image"] = cabledata["image"]
|
||||
if "description" in cabledata:
|
||||
tmp1["description"] = cabledata["description"]
|
||||
if "short_description" in cabledata:
|
||||
tmp1["short_description"] = cabledata["short_description"]
|
||||
if "application" in cabledata:
|
||||
tmp1["application"] = cabledata["application"]
|
||||
if "category" in cabledata:
|
||||
tmp1["category"] = cabledata["category"]
|
||||
|
||||
dataout["map"].append(tmp1)
|
||||
|
||||
# after loop
|
||||
send_data(decoded["type"], "send", dataout, client_id)
|
||||
|
||||
case "keyboard":
|
||||
fprint("keyboard message")
|
||||
if call == "send":
|
||||
|
Loading…
x
Reference in New Issue
Block a user