szdiyCam project runs on top of a Raspberry Pi with its camera board. It takes a picture every 20sec and uploads it to a custom image API server and QiNiu. The pictures taken are stored away in a local folder for later retrieval. The project is a community project by SZDIY Hackers' Community.
The default directory can be changed in
/tmpfor temporary picture storage before moving to a archive location
/home/pi/szdiy_imgstores every pictures taken. They are sorted by date into different folders.
Clone the project
Setup virtual environment to ensure anything you did inside the directory does not pollute OS
Install dependencies using pip
pip install -r requirements.txt
(optional) EXIF support
pyexiv2which is used to make sure
exifdata is copied over correctly
sudo apt-get install python-pyexiv2
pyexiv2library to virtual environment
ln -s /usr/lib/python2.7/dist-packages/libexiv2python.so venv/lib/python2.7/site-packages/ ln -s /usr/lib/python2.7/dist-packages/pyexiv2 venv/lib/python2.7/site-packages/
credentials.py. You will need to arrange your own picture API server there. The sample used QiNiu and a custom written API image server backend which is not part of this project. But it can be easily extended for other image uploading service such as Imagur API by creating your own uploading functions.
If you get a QiNiu API key successfully setup in step 6, you can now run without any issues
(Optional) A clear archive script is added for maintenance. You can add it to crontab so it can run once everyday. $ crontab -e 0 0 * * * python /home/pi/szdiyCam/clearArchive.py 1>>/home/pi/szdiycam_cleararchive.log 2>> /home/pi/szdiycam_cleararchive.log &
###Wechat 微信 Wechat is integrated in the uploading process. Our backend server handles normal picture upload and Wechat API at a single URL endpoint (not included in this project).
uploadAFileToLinodeWithWXMediaID handles uploading image to the Wechat server as well as our backend server. It reports the Wechat server response to our backend. Our backend will use this info to redeliver captured images stored on Wechat server to a Wechat App. To use without Wechat, use
###Setup as System Service
Make it executable
sudo chmod +x uploadingimage
Make it run at startup
update-rc.d uploadingimage defaults
For debugging purpose, you can reconnect this session by running
sudo screen -r 'uploading image'
#License GPL V3
Copyright (C) 2014 SZDIY Hackers' Community szdiyCam is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. szdiyCam is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with szdiyCam. If not, see <http://www.gnu.org/licenses/>.