lilliputten / cam-server

Cam flask photo receiver server & raspberry camera client

Home Page:http://cam.lilliputten.ru/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cam flask photo receiver server & raspberry camera client

Build info (auto-generated)

  • Version: 0.0.5
  • Last changes timestamp: 2021.05.02, 19:16
  • Last changes timetag: 210502-1916

API

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:

Server

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 interface

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.

Raspberry camera client

Use client-make-and-upload-image.sh script to make & upload image to server.

Use crontab to automate image capture.

Sample crontab lines:

  • 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

Real crontab entry example:

# # 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

Crontab commands:

Edit crontab:

crontab -e

Show crontab:

crontab -l

See also:

Crontab logging

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

About

Cam flask photo receiver server & raspberry camera client

http://cam.lilliputten.ru/

License:MIT License


Languages

Language:Python 63.8%Language:Shell 19.5%Language:HTML 13.3%Language:Batchfile 1.7%Language:JavaScript 0.9%Language:Vim Script 0.7%