gphoto2-web

REST web API for the libgphoto2 library. You can use it to take pictures, previews (handy for implementing poor man's liveview feature), control/obtain various camera settings, and access connected camera's filesystem - all via JSON-based requests.
Installation
- After cloning the repo you need to call
shards installin order to obtain needed dependencies - Next, execute
shards build(possibly with--productionflag) to build the binary - You're ready to go! It's as easy as running
./bin/serverand checking the http://localhost:3000/cameras for list of detected cameras - Passing
SENTRY_DSNenv var while building/running will provide you with error reporting
Usage
Available endpoints
/cameras
-
GET /camerasParameters:
| name | value | description | | -------- | ------ | ---------------------------------- | |
reload|true| Reloads the camera list beforehand |
/cameras/:id
-
GET /cameras/:id -
GET /cameras/:id/captureParameters:
| name | value | description | | -------- | ------ | ------------------------------- | |
delete|true| Deletes the image after capture | -
GET /cameras/:id/preview -
GET /cameras/:id/exit
/cameras/:id/config
-
GET /cameras/:id/configParameters:
| name | value | description | | ------ | ------ | --------------------------------------------------------------- | |
flat|true| Returns one-dimensional configuration map, keyed by widget name | -
PATCH /cameras/:id/configExample request:
curl \ -X PATCH \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{"whitebalance": "Automatic", "iso": 800, "f-number": "f/4.5"}' \ "http://localhost:3000/cameras/5a337150-30ba-40fd-adc2-b9ffacdad188/config"
/cameras/:id/config/:widget
-
GET /cameras/:id/config/:widget -
PATCH /cameras/:id/config/:widgetExample request:
curl \ -X PATCH \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{"value": "Automatic"}' \ "http://localhost:3000/cameras/5a337150-30ba-40fd-adc2-b9ffacdad188/config/whitebalance"
/cameras/:id/fs
GET /cameras/:id/fsGET /cameras/:id/fs/*pathDELETE /cameras/:id/fs/*path
/cameras/:id/blob
-
GET /cameras/:id/blob/*filepathParameters:
| name | value | description | | ---------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | |
download|true| Makes the browser download the image instead of displaying it | |format|jpeg/webp/avif/png/auto| Returns the image in a given format,autochooses betweenavif,webpandjpeg(in that order), depending on the browser support | |width| integer | Returns the image scaled down to the given width | |height| integer | Returns the image scaled down to the given height | -
DELETE /cameras/:id/blob/*filepath
/cameras/:id/zip
GET /cameras/:id/zipGET /cameras/:id/zip/*path
Development
- Pass
DEBUG=1inshards buildstep to compile-in the debug support. Afterwards you can use it by passingDEBUG=1env variable when running the server (DEBUG=1 ./bin/server)
Contributing
- Fork it (https://github.com/Sija/gphoto2-web/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Sija Sijawusz Pur Rahnama - creator, maintainer