- Version: 0.0.5
- Last changes timestamp: 2021.05.02, 19:16
- Last changes timetag: 210502-1916
Basic api structure (server v.0.0.5+):
- GET
/api/images
: Get all images list. - GET
/api/images/recent
: Get recent image info. - GET
/api/images/{id}
: Get specific image info. - POST
/api/images/add
: Add (upload) new image. (Duplicates/upload
?) - DELETE
/api/images
: Delete all images. - DELETE
/api/images/{id}
: Delete specific image.
See also:
- JSON:API — Latest Specification (v1.0)
- JSON API – работаем по спецификации / Блог компании Конференции Олега Бунина (Онтико) / Хабр
- REST — Википедия
Images server runs on python/flask platform.
It has 3 interfaces: template-based bootstrap application, api interface (json), react spa application (overt api; in progress).
Camera shots are taken using the raspistill
program using commands like:
# Default:
raspistill -o image.jpg
# Half:
raspistill -w 1296 -h 972 -o image-half.jpg
# Half:
raspistill -w 648 -h 486 -o image-quarter.jpg
For commandline reference use raspistill --help
.
Use client-make-and-upload-image.sh
script to make & upload image to server.
Use crontab to automate image capture.
- Every minute:
* * * * * /home/pi/cam-client/client-make-and-upload-image.sh
- Every 15th minute:
*/15 * * * * /home/pi/cam-client/client-make-and-upload-image.sh
# # Test entry...
# 30 */1 * * * date >> ~/test_crontab
# Make & upload shots every 15 minutes (with forced logging)...
*/5 * * * * sh /home/pi/cam-client/client-make-and-upload-image.sh >> /home/pi/cam-client/cron-log.txt 2>&1
# Make & upload shots every 20 minutes...
*/20 * * * * sh /home/pi/cam-client/client-make-and-upload-image.sh
# Reboot every 3 hours (00:55, 03:55, etc...)
55 */3 * * * sudo reboot -f
Edit crontab:
crontab -e
Show crontab:
crontab -l
See also:
Uncomment # cron.*
line in /etc/rsyslog.conf
(eg. edit with sudo vim /etc/rsyslog.conf
).
Show crontab log:
tail -f /var/log/cron.log
Or use output reirect in command:
/home/pi/cam-client/client-make-and-upload-image.sh >> /home/pi/cam-client/cron.log 2>&1
python /home/pi/cam-client/client-make-image.py >> /home/pi/cam-client/cron.log 2>&1