Python binding for Sony Camera API
Project description
libsonyapi
Python binding for the Sony Camera API
REQUIREMENTS
- a compatible Sony camera (find your camera here)
- wifi connection
INSTALLATION
pip install libsonyapi
OR FROM SOURCE:
git clone https://github.com/petabite/libsonyapi.gitor download the latest releasecd libsonyapipython setup.py install
Required:
QUICKSTART
from libsonyapi.camera import Camera
from libsonyapi.actions import Actions
camera = Camera() # create camera instance
camera_info = camera.info() # get camera camera_info
print(camera_info)
print(camera.name) # print name of camera
print(camera.api_version) # print api version of camera
camera.do(Actions.actTakePicture) # take a picture
fNumber = camera.do(Actions.getFNumber)
print(fNumber) # prints fnumber
camera.do(Actions.setFNumber, "5") # set aperture to 5
HOW IT WORKS
- establishes connection with camera thru upnp ssdp protocol
- make calls to camera via http post and json body
- camera responds with json w/ info such as status and info if required by http call
DOCS
Objects
- libsonyapi.Camera()
- init a Camera object
- libsonyapi.Actions()
- do not need to create instance
- contains string literals of sony camera api methods for convenience (auto-complete)
Parameters
- Camera.name
- name of the camera
- Camera.api_version
- api version of camera
- Camera.services
- list of services available on camera
- Camera.available_apis
- list of apis currently available on camera
Methods
- Camera.info(self)
- returns camera info(name, api_version, supported services, available api) in dict
- Camera.do(self, method, param=[]):
- METHOD: libsony.Actions.method, where method is one listed in the API LIST below
- PARAM(optional): accepts string of param if METHOD is a method that sets a value on the camera
- Returns the json response from the camera (for debugging)
- NOTE: your camera may not support all methods. use
Camera.do("getAvailableApiList")['result']to get currently available APIs. - Refer to Sony Camera API docs for function of method and supported params
EXAMPLES
- pylapse - uses libsonyapi to automatically capture pictures for a timelapse
API LIST
The table below shows the name of variables in the libsonyapi Actions class and its corresponding Sony Camera API method name
| libsonyapi Variable Name | Sony API Method Name |
|---|---|
| setShootMode | 'setShootMode' |
| getShootMode | 'getShootMode' |
| getSupportedShootMode | 'getSupportedShootMode' |
| getAvailableShootMode | 'getAvailableShootMode' |
| actTakePicture | 'actTakePicture' |
| awaitTakePicture | 'awaitTakePicture' |
| startContShooting | 'startContShooting' |
| stopContShooting | 'stopContShooting' |
| startMovieRec | 'startMovieRec' |
| stopMovieRec | 'stopMovieRec' |
| startAudioRec | 'startAudioRec' |
| stopAudioRec | 'stopAudioRec' |
| startIntervalStillRec | 'startIntervalStillRec' |
| stopIntervalStillRec | 'stopIntervalStillRec' |
| startLoopRec | 'startLoopRec' |
| stopLoopRec | 'stopLoopRec' |
| startLiveview | 'startLiveview' |
| stopLiveview | 'stopLiveview' |
| startLiveviewWithSize | 'startLiveviewWithSize' |
| getLiveviewSize | 'getLiveviewSize' |
| getSupportedLiveviewSize | 'getSupportedLiveviewSize' |
| getAvailableLiveviewSize | 'getAvailableLiveviewSize' |
| setLiveviewFrameInfo | 'setLiveviewFrameInfo' |
| getLiveviewFrameInfo | 'getLiveviewFrameInfo' |
| actZoom | 'actZoom' |
| setZoomSetting | 'setZoomSetting' |
| getZoomSetting | 'getZoomSetting' |
| getSupportedZoomSetting | 'getSupportedZoomSetting' |
| getAvailableZoomSetting | 'getAvailableZoomSetting' |
| actHalfPressShutter | 'actHalfPressShutter' |
| cancelHalfPressShutter | 'cancelHalfPressShutter' |
| setTouchAFPosition | 'setTouchAFPosition' |
| getTouchAFPosition | 'getTouchAFPosition' |
| cancelTouchAFPosition | 'cancelTouchAFPosition' |
| actTrackingFocus | 'actTrackingFocus' |
| cancelTrackingFocus | 'cancelTrackingFocus' |
| setTrackingFocus | 'setTrackingFocus' |
| getTrackingFocus | 'getTrackingFocus' |
| getSupportedTrackingFocus | 'getSupportedTrackingFocus' |
| getAvailableTrackingFocus | 'getAvailableTrackingFocus' |
| setContShootingMode | 'setContShootingMode' |
| getContShootingMode | 'getContShootingMode' |
| getSupportedContShootingMode | 'getSupportedContShootingMode' |
| getAvailableContShootingMode | 'getAvailableContShootingMode' |
| setContShootingSpeed | 'setContShootingSpeed' |
| getContShootingSpeed | 'getContShootingSpeed' |
| getSupportedContShootingSpeed | 'getSupportedContShootingSpeed' |
| getAvailableContShootingSpeed | 'getAvailableContShootingSpeed' |
| setSelfTimer | 'setSelfTimer' |
| getSelfTimer | 'getSelfTimer' |
| getSupportedSelfTimer | 'getSupportedSelfTimer' |
| getAvailableSelfTimer | 'getAvailableSelfTimer' |
| setExposureMode | 'setExposureMode' |
| getExposureMode | 'getExposureMode' |
| getSupportedExposureMode | 'getSupportedExposureMode' |
| getAvailableExposureMode | 'getAvailableExposureMode' |
| setFocusMode | 'setFocusMode' |
| getFocusMode | 'getFocusMode' |
| getSupportedFocusMode | 'getSupportedFocusMode' |
| getAvailableFocusMode | 'getAvailableFocusMode' |
| setExposureCompensation | 'setExposureCompensation' |
| getExposureCompensation | 'getExposureCompensation' |
| getSupportedExposureCompensation | 'getSupportedExposureCompensation' |
| getAvailableExposureCompensation | 'getAvailableExposureCompensation' |
| setFNumber | 'setFNumber' |
| getFNumber | 'getFNumber' |
| getSupportedFNumber | 'getSupportedFNumber' |
| getAvailableFNumber | 'getAvailableFNumber' |
| setShutterSpeed | 'setShutterSpeed' |
| getShutterSpeed | 'getShutterSpeed' |
| getSupportedShutterSpeed | 'getSupportedShutterSpeed' |
| getAvailableShutterSpeed | 'getAvailableShutterSpeed' |
| setIsoSpeedRate | 'setIsoSpeedRate' |
| getIsoSpeedRate | 'getIsoSpeedRate' |
| getSupportedIsoSpeedRate | 'getSupportedIsoSpeedRate' |
| getAvailableIsoSpeedRate | 'getAvailableIsoSpeedRate' |
| setWhiteBalance | 'setWhiteBalance' |
| getWhiteBalance | 'getWhiteBalance' |
| getSupportedWhiteBalance | 'getSupportedWhiteBalance' |
| getAvailableWhiteBalance | 'getAvailableWhiteBalance' |
| actWhiteBalanceOnePushCustom | 'actWhiteBalanceOnePushCustom' |
| setProgramShift | 'setProgramShift' |
| getSupportedProgramShift | 'getSupportedProgramShift' |
| setFlashMode | 'setFlashMode' |
| getFlashMode | 'getFlashMode' |
| getSupportedFlashMode | 'getSupportedFlashMode' |
| getAvailableFlashMode | 'getAvailableFlashMode' |
| setStillSize | 'setStillSize' |
| getStillSize | 'getStillSize' |
| getSupportedStillSize | 'getSupportedStillSize' |
| getAvailableStillSize | 'getAvailableStillSize' |
| setStillQuality | 'setStillQuality' |
| getStillQuality | 'getStillQuality' |
| getSupportedStillQuality | 'getSupportedStillQuality' |
| getAvailableStillQuality | 'getAvailableStillQuality' |
| setPostviewImageSize | 'setPostviewImageSize' |
| getPostviewImageSize | 'getPostviewImageSize' |
| getSupportedPostviewImageSize | 'getSupportedPostviewImageSize' |
| getAvailablePostviewImageSize | 'getAvailablePostviewImageSize' |
| setMovieFileFormat | 'setMovieFileFormat' |
| getMovieFileFormat | 'getMovieFileFormat' |
| getSupportedMovieFileFormat | 'getSupportedMovieFileFormat' |
| getAvailableMovieFileFormat | 'getAvailableMovieFileFormat' |
| setMovieQuality | 'setMovieQuality' |
| getMovieQuality | 'getMovieQuality' |
| getSupportedMovieQuality | 'getSupportedMovieQuality' |
| getAvailableMovieQuality | 'getAvailableMovieQuality' |
| setSteadyMode | 'setSteadyMode' |
| getSteadyMode | 'getSteadyMode' |
| getSupportedSteadyMode | 'getSupportedSteadyMode' |
| getAvailableSteadyMode | 'getAvailableSteadyMode' |
| setViewAngle | 'setViewAngle' |
| getViewAngle | 'getViewAngle' |
| getSupportedViewAngle | 'getSupportedViewAngle' |
| getAvailableViewAngle | 'getAvailableViewAngle' |
| setSceneSelection | 'setSceneSelection' |
| getSceneSelection | 'getSceneSelection' |
| getSupportedSceneSelection | 'getSupportedSceneSelection' |
| getAvailableSceneSelection | 'getAvailableSceneSelection' |
| setColorSetting | 'setColorSetting' |
| getColorSetting | 'getColorSetting' |
| getSupportedColorSetting | 'getSupportedColorSetting' |
| getAvailableColorSetting | 'getAvailableColorSetting' |
| setIntervalTime | 'setIntervalTime' |
| getIntervalTime | 'getIntervalTime' |
| getSupportedIntervalTime | 'getSupportedIntervalTime' |
| getAvailableIntervalTime | 'getAvailableIntervalTime' |
| setLoopRecTime | 'setLoopRecTime' |
| getLoopRecTime | 'getLoopRecTime' |
| getSupportedLoopRecTime | 'getSupportedLoopRecTime' |
| getAvailableLoopRecTime | 'getAvailableLoopRecTime' |
| setWindNoiseReduction | 'setWindNoiseReduction' |
| getWindNoiseReduction | 'getWindNoiseReduction' |
| getSupportedWindNoiseReduction | 'getSupportedWindNoiseReduction' |
| getAvailableWindNoiseReduction | 'getAvailableWindNoiseReduction' |
| setAudioRecording | 'setAudioRecording' |
| getAudioRecording | 'getAudioRecording' |
| getSupportedAudioRecording | 'getSupportedAudioRecording' |
| getAvailableAudioRecording | 'getAvailableAudioRecording' |
| setFlipSetting | 'setFlipSetting' |
| getFlipSetting | 'getFlipSetting' |
| getSupportedFlipSetting | 'getSupportedFlipSetting' |
| getAvailableFlipSetting | 'getAvailableFlipSetting' |
| setTvColorSystem | 'setTvColorSystem' |
| getTvColorSystem | 'getTvColorSystem' |
| getSupportedTvColorSystem | 'getSupportedTvColorSystem' |
| getAvailableTvColorSystem | 'getAvailableTvColorSystem' |
| startRecMode | 'startRecMode' |
| stopRecMo | 'stopRecMo' |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
libsonyapi-1.0.tar.gz
(10.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libsonyapi-1.0.tar.gz.
File metadata
- Download URL: libsonyapi-1.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
301e9040a6cdbf1de61b3f7bfae6576b2148b7611006a5c687c59a5f2c2b867f
|
|
| MD5 |
7e34fe7e6fc6db697387fb749d95b3d0
|
|
| BLAKE2b-256 |
32715c9108e5562e6057d60940d325c13802b1f7edfecb03282b35e30c7e2677
|
File details
Details for the file libsonyapi-1.0-py3-none-any.whl.
File metadata
- Download URL: libsonyapi-1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e4c67aa83566bd399224bfa94a613beafaa6d40277e8100e5d45464d30bf3c8
|
|
| MD5 |
17d3080c7b576979d35fc8f1ab68f73b
|
|
| BLAKE2b-256 |
53ea4ae93d25fac5afa01ece4b3870c97cf442a189cf5b47f7395cc6a81f1845
|