-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
103 lines (72 loc) · 3.06 KB
/
Makefile
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
IMAGE=michaelbosworth/project-leroy
build:
docker build --platform linux/arm . -t $(IMAGE)
push: build
docker push michaelbosworth/project-leroy:latest
down:
docker compose down
run: down
xhost +
docker compose up
# docker run -t --privileged --name leroy --device /dev/video0 --device /dev/gpiomem -v `pwd`:/usr/src/app/ -v /dev/bus/usb:/dev/bus/usb -t $(IMAGE):latest
# docker stop leroy || true
run_continuous:
docker run -t --privileged --device /dev/video0 --restart unless-stopped --device /dev/gpiomem -v `pwd`:/usr/src/app/ -v /dev/bus/usb:/dev/bus/usb -t $(IMAGE):latest
start_machine:
docker-machine start
change_docker_env: start_machine
eval $(docker-machine env default)
run_on_mac:
docker run -it --privileged --device /dev/video0 -v `pwd`:/usr/app/src -v /dev/bus/usb:/dev/bus/usb -v `pwd`/all_models:/usr/src/app/all_models -v `pwd`/dev_storage:/usr/src/app/storage -p 5005:5005 -t $(IMAGE):latest
restore_docker_env:
docker-machine stop
eval $(docker-machine env -u)
service_install:
sudo cp service/leroy.service /lib/systemd/system/leroy.service
sudo chmod 644 /lib/systemd/system/leroy.service
sudo systemctl daemon-reload
sudo systemctl enable leroy.service
service_recent_logs:
sudo journalctl -u leroy.service -b
service_logs:
sudo journalctl -u leroy.service
service_status:
sudo systemctl status leroy.service
service_start:
sudo systemctl start leroy.service
service_stop:
sudo systemctl stop leroy.service
service_edit:
sudo nano /lib/systemd/system/leroy.service
service_reload:
sudo systemctl daemon-reload
service_enable:
sudo systemctl enable leroy.service
service_disable:
sudo systemctl disable leroy.service
service_restart:
sudo systemctl restart leroy.service
cron_logs:
grep CRON /var/log/syslog
pi_edit_service:
sudo nano /etc/systemd/system/leroy.service
classify:
docker run -t -e DRY_RUN=${DRY_RUN} -v `pwd`:/usr/src/app/ $(IMAGE):latest classify.py --dir=storage/detected --dryrun=${DRY_RUN}
generate_daily_report:
docker run -t -e DATE=${DATE} -v /var/www/html:/var/www/html -v `pwd`:/usr/src/app/ $(IMAGE):latest visitation.py --dir=/var/www/html/classified --date=${DATE}
sync_from_pi:
rsync --remove-source-files --exclude 'detected/*' --exclude 'results.log' -avzhe "ssh -p22" [email protected]:/var/www/html/classified/ `pwd`/storage/classifed
sync_to_pi:
rsync --remove-source-files -avzhe "ssh -p22" `pwd`/storage/detected/ [email protected]:/home/pi/Projects/project-leroy/storage/detected
mp4_to_gif:
docker run -t -e INPUT=${INPUT} -e OUTPUT=${OUTPUT} -v `pwd`/storage/:/usr/src/app/ --entrypoint="ffmpeg" $(IMAGE):latest \
-i ${INPUT} -ss 1 -t 5 -vf "fps=4,scale=1024:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" ${OUTPUT}
mp4_to_h264:
docker run -t -e INPUT=${INPUT} -e OUTPUT=${OUTPUT} -v `pwd`:/usr/src/app/ --entrypoint="sh" $(IMAGE):latest ./encode.sh
bash:
docker run -it -v `pwd`/storage/:/usr/src/app/ --entrypoint="bash" $(IMAGE):latest
set_resolution:
v4l2-ctl -v width=3280,height=2464
bcm2835-v4l2 max_video_width=3280 max_video_height=2464
tail:
tail -f storage/results.log