Git Product home page Git Product logo

gopro's Introduction

GoPro

A complete Python GoPro module made easy.

GoPro

Works with HERO4 cameras and HERO5 cameras, HERO+ cameras may work too. Older cameras are not supported.

NOTE: This library is no longer maintained by @DenisCarriere - @KonradIT will be adding features from firmware updates and merging PRs. There is another python library goprohero which you can use too.

PyPI version

Install

This library only works with Python 2, make sure you eitehr run this on a virtual env or on a python2 installation.

virtualenv -p /usr/bin/python2.7 /path/to/env/
source /path/to/env/bin/activate

Easy install with Github or PyPi

Installing the latest version from GitHub.

$ git clone https://github.com/DenisCarriere/gopro.git
$ cd gopro
$ python setup.py install

Installing the tested version from PyPi.

$ sudo pip install gopro

Quickstart

Once the installation is complete you are ready to start! :)

The default IP address for the GoPro is using 10.5.5.9.

You must first be connected to the GoProApp Wifi connection.

Launch your favorite ipython or standard python

>>> from gopro import GoPro
>>> camera = GoPro.GoPro()
>>> camera.status
{'connection': 'OK',
 'datetime': '2014-11-12T23:53:59',
 'ip': '10.5.5.9',
 'ok': True,
 'screen': 'video',
 'storage': '31.3 GB',
 'time_offset': 'now'}
...

Take a Photo or Video

With very simple commands you can tell your GoPro to switch to the appropiate mode and start recording or take a photo.

The screen will automatically change to the approriate mode.

>>> camera.photo()
>>> camera.video()
>>> camera.timelapse()

Note, if you want to trigger the shutter button use camera.capture()

Stopping

For video or timelapse you can stop the recording.

>>> camera.stop()

Camera modes

Makes it easy to cycle threw each available modes.

>>> camera.mode('video')
>>> camera.mode('photo')
>>> camera.mode('multishot)
...

Locate (Beep! Beep!)

Can't find your device?? Call the locate function and it will Beep endlessly until there is no more battery.

To turn off the beeps, simply press the mode button on the device or use the off as a parameter.

>>> camera.locate('on')
>>> camera.locate('off')
...

Sleep

The camera will turn itself off, the Wi-Fi will still be active.

At the moment there is no working commands to turn the device back on.

To reactivate the device, press the mode button.

>>> camera.sleep()
...

##Wake up

Turns the camera on (when WiFi is still active)

>>>camera.poweron()
...

Delete Photos

Might be useful to dump all those photos from your GoPro.

Warning once you delete photos/videos you cannot retrieve them back.

The erase function does the same as the delete all.

The delte_file will delete a single file you specify

>>> camera.erase()
>>> camera.delete_all()
>>> camera.delete_last()
>>> camera.delete_file("100GOPRO","GOPR0665.JPG")
...

Settings

You can explore the different types of settings & status by getting the raw JSON response or selecting a specific pre-parsed attribute

Processed attributes

Status - Screen

This will let you know which page your GP is currently active.

There are only 4 available outcomes.

>>> camera.status_screen
'settings'
'video'
'photo'
'timelapse'
...

Raw JSON Responses

The original response from the GoPro device.

>>> camera.settings_raw
>>> camera.status_raw
...

Date & Time

It is a good idea to sync your GoPro with the same clock as your computer.

An easy way to do this is use the datetime & time_offset attribute.

Try to aim your GoPro to have less than 1 second offset.

The time_offset is measured in (+/-) seconds.

>>> camera.datetime
'2014-11-12 21:53:09'
>>> camera.datetime_offset
-0.320142
>>> camera.status['offset']
'now'
...

File Storage

Here is how you can retrieve the total file storage in (KB) or pretty human readeable format.

>>> camera.status_storage
31330144
>>> camera.status['storage']
'31.3 GB'

Debug

Want to explore & troubleshoot the device a bit, you can retrieve the following properties from your device.

>>> camera.debug
>>> camera.info
>>> camera.commands
...

Contributors

A big thanks to all the people who have helped contribute!

To be a contributor, please message me with requests on Twitter/Github issues

License

The MIT License (MIT)

Copyright (c) 2014-2017 Denis Carriere

gopro's People

Contributors

arthurbenemann avatar beader avatar deniscarriere avatar dschoorisse avatar konradit avatar owenarnold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gopro's Issues

Get Current Photo & Video

>>> camera.current
{'photo':68, 'video':3}
...
>>> camera.current_photo
68
>>> camera.current_video
3

Build a Test function

Need to know when the camera is Active or not

>>> import gopro
>>> camera = gopro.camera()
>>> camera.ok
True
>>> camera
<GoPro Camera [OK]>

# Or if not connected
>>> camera.ok
False
>>> camera
<GoPro Camera [Not Connected]>

ValueError: hour must be 0..23

Just trying out the library (today, at 2017-02-11, 17.29h). Thanks for sharing this! However, today loading the library failed with the following error:

  File "./GoPro.py", line 180, in datetime
    d = datetime.datetime(d[0] + 2000, d[1], d[2], d[3], d[4], d[5])
ValueError: hour must be in 0..23

Raw output from the GoPro: %11%02%0B%29%1D%30
Which translates to: [17, 2, 11, 41, 29, 48]

When I subtract 24 from 41 I find the correct value of 17.

This seems to happen when my GoPro is powered on for >24h (running from a wall adapter).

no "12" key in status

I don't have a key "12" in status.

status_screen = status_screen[self.status_raw.get('12')]
KeyError: None

output of the http://10.5.5.9/gp/gpControl/status/
{"status":{
"1":1,"2":2,"3":0,"4":0,"6":0,"8":0,"9":0,"10":0,"11":0,"13":0,"14":0,"15":0,"16":0,"17":1,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"26":0,"27":0,"28":2,"29":"","30":"","31":1,"32":0,"33":0,"34":2331,"35":3906,"36":0,"37":0,"38":0,"39":0,"40":"%0F%06%18%14%1F%17","41":0,"42":0,"43":0,"44":0,"45":0,"46":1,"47":1,"48":1,"49":0,"54":15508576,"55":1,"56":4,"57":856028,"58":0,"59":0},
"settings": {"1":0,"2":9,"3":5,"4":0,"5":0,"6":1,"7":1,"8":0,"9":0,"10":0,"11":0,"12":0,"13":1,"14":0,"15":4,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":4,"27":0,"28":0,"29":5,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":4,"40":0,"41":13,"42":8,"43":0,"44":8,"45":8,"46":0,"47":0,"48":0,"49":0,"50":1,"51":1,"52":1,"53":0,"54":0,"55":2,"56":0,"57":0,"58":1,"59":0,"60":8,"61":1,"62":700000,"63":1,"64":1,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":1}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.