-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
41 lines (30 loc) · 1000 Bytes
/
Copy pathapp.py
File metadata and controls
41 lines (30 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/python3
import json
import os, sys
from sensors import growbme280
from camera import camera
from specimen import specimen
if __name__ == "__main__":
print("Starting growlab")
config = {}
try:
with open("./config.json") as f:
config = json.loads(f.read())
except Exception as e:
sys.stderr.write("Error: {}".format(e))
sys.exit(1)
print("Loaded config, saving images every {} seconds to {}".format( config["images"]["interval_seconds"], config["images"]["output_directory"]))
bme280 = growbme280()
readings = bme280.get_readings()
print(readings)
cam = camera(config["images"])
frame = cam.get_frame()
pwd = os.getcwd()
output_path = pwd + "/html"
try:
os.mkdir(output_path)
except:
pass
spec = specimen(config["text"], config["images"])
spec.save_image("{}/image.jpg".format(pwd), frame, readings)
spec.save_html("{}/image.jpg".format(pwd), output_path, readings)