Skip to main content

Getting started

pip package

pip install ptpip

d5300 sample file

from ptpip.client import PtpIpClient
from ptpip.report.html_device import HtmlDeviceReportGenerator

async def usePtpIpClient(client: PtpIpClient):
    device = await client.getDeviceInfo()
    props = []
    for idx, prop in enumerate(device.properties):
        prop_desc = await client.getDevicePropDesc(
            prop=prop,
            delay=0
        )
        props.append(prop_desc)

    discoveredProps = await client.discoverDevicePropDesc(device, delay=0)

    html = HtmlDeviceReportGenerator(device, props, discoveredProps) \
        .generate()

    reportFileName = 'd5300.html'
    f = open(reportFileName, 'w')
    f.write(html)
    f.close()

    print('Report saved ! ' + reportFileName)

    setExposureIndexResponse = await client.setDevicePropValue(
        prop = DevicePropertyType.ExposureIndex.value,
        propType = PropertyType.Uint16,
        value = 3200
    )

    print('setExposureIndexResponse: ' + str(setExposureIndexResponse))

    exposureIndex = await client.getDevicePropValue(
        prop = DevicePropertyType.ExposureIndex.value,
        propType = PropertyType.Uint16
    )

    print('Exposure index : ' + str(exposureIndex))

PtpIpClient(usePtpIpClient)

OR use CLI

# Main Help
python3 console.py --help

# Generate full device report
python3 console.py device  --discover=True --more=True --report=d5300.html

# Get device property description for ExposureIndex
python3 console.py propdesc --name=ExposureIndex

# Get device property value for ExposureIndex
python3 console.py getprop --debug=False --name=ExposureIndex

# Set device property value for ExposureIndex to 6400
python3 console.py setprop --debug=False --name=ExposureIndex --value=6400

# Take a picture with current device configuration and redirect output to cap.jpg
python3 console.py capture --debug=False > cap.jpg

# Take a picture with current device configuration and save it to cap.jpg
python3 console.py capture --debug=False --output=cap.jpg

# List all storage ids
python3 console.py storageids

# Show storage info
python3 console.py storage --id=65537

# Count objects in given storage
python3 console.py numobjects --id=65537

# Lists all Jpeg files on main storage (SDCard) (including example 689504257 handle)
python3 console.py objhandles --id=65537 --formatname=ExifJpeg

# Show object info
python3 console.py objinfo --handle=689504257

# Show object format supported properties
python3 console.py formatprops --name=ExifJpeg --names=True

# Live view writing in cap.jpg at 60 fps
python3 console.py liveimg --output=cap.jpg --fps=60

# Show cap.jpg at 60fps in terminal using Viu : https://github.com/atanunq/viu
while true; do $(viu cap.jpg); sleep 0.016666666666666666; done;

Sample report for Nikon d5300

References

https://github.com/mmattes/ptpip
http://www.gphoto.org/doc/ptpip.php
https://github.com/Fimagena/libptp
https://github.com/whoozle/android-file-transfer-linux/tree/master/mtp/ptp
https://github.com/Parrot-Developers/sequoia-ptpy/blob/master/ptpy/ptp.py https://api.ricoh/docs/theta-web-api/property/still_capture_mode/

https://manualzz.com/download/46005016 D5000 MTP Specifications
https://www.usb.org/sites/default/files/MTPv1_1.zip
https://github.com/gphoto/libgphoto2/

Metadata

Release files for ptpip 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ptpip 0.0.10
File Size Uploaded
ptpip-0.0.10.tar.gz 40.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ptpip 0.0.10
File Interpreter ABI Platform
ptpip-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 112.8 kB

Release files / ptpip-0.0.10.tar.gz

Download URL ptpip-0.0.10.tar.gz
Size 40.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4c24c0fef36460290bf3866d663d04e321d696415e68291e202e877452693bb6
BLAKE2b-256 checksum
How to use checksums
6200928ceada4c37ec2fb53fa03dad8a636f32b50fd62da42b1e26f324569d19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/3.7.2 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.2

Release files / ptpip-0.0.10-py3-none-any.whl

Download URL ptpip-0.0.10-py3-none-any.whl
Size 72.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
304755342438d8fad943a80696a9b0cee4d24b342bc1d6535d664069bd1fba10
BLAKE2b-256 checksum
How to use checksums
fc3a588812f5223487727a5cb33ba329221d01535025ca47cd2f4794bc754601
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/3.7.2 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page