Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Datetime of GoPro #5

Closed
DenisCarriere opened this issue Dec 1, 2014 · 8 comments
Closed

Datetime of GoPro #5

DenisCarriere opened this issue Dec 1, 2014 · 8 comments

Comments

@DenisCarriere
Copy link

Being able to sync your GoPro with your computer can be tricky since you don't know the seconds on the GoPro, only the minutes are displayed on the screen.

Would be nice to have an attribute added to the status that would have the a datetime object called datetime when the status is called.

It comes in handy when you are trying to sync a GPX track with the GoPro's photos/videos.

>>> c = GoProHero()
>>> c.status()
{...
'datetime': '2014-11-30T22:09:40'
}
@joshvillbrandt
Copy link
Owner

Hey Denis,

Check out the GoProController application. The GoProController does include the timestamp from the first attempt at communication.

If you don't want the overhead of that application, I'd suggest saving the timestamp in your own application right before calling c.status(). This is exactly what the GoProController is doing.

@DenisCarriere
Copy link
Author

Maybe I explained it wrong by saying the status call. I meant retrieving the Timestamp of the device, the clock time, I don't know about the GoPro3, but in the Hero 4 you can call http://10.5.5.9/gp/gpControl/status with this as the response:

{"status":{
"1":1,"2":3,"3":0,"4":0,"6":0,"8":0,"9":0,"10":0,"11":0,"12":3,"13":0,
"14":0,"15":0,"16":0,"17":1,"19":0,"20":0,"22":0,"24":0,"26":0,"27":0,
"28":2,"29":"","30":"","31":0,"32":0,"33":0,"34":12226,"35":4053,
"36":0,"37":0,"38":0,"39":0,"40":"%0E%0C%01%12%27%0D","41":0,"42":0,"43":2,"44":1,"45":0,"46":1,"47":1,"48":1,
"49":0,"54":31330112,"55":1,"56":4},
"settings": {"1":0,"2":9,"3":1,"4":0,"5":0,"6":1,"7":1,"8":1,"9":0,"10":1,"11":0,
"12":0,"13":0,"14":0,"15":4,"16":0,"17":2,"18":0,"19":0,"20":1,"21":1,
"22":0,"23":0,"24":0,"25":0,"26":4,"27":1,"28":0,"29":5,"30":2,"31":0,
"32":0,"33":1,"34":1,"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":2,"54":0,"55":2,"56":1,"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":1,"71":0,"72":1}}

The key that is used for the Clock Timestamp is 40 which returns %0E%0C%01%12%27%0D which is base 16, now this string isn't very useful without being parsed.

I parsed it using a few basic lines of code.

>>> import datetime
>>> d = []
>>> for item in self.status_raw.get('40')[1:].split('%'):
>>>      d.append(int(item, 16))
>>>      d = datetime.datetime(d[0] + 2000, d[1], d[2], d[3], d[4], d[5]) 

The ideal end result for this requests would be as simple as

>>> c = GoProHero()
>>> c.clock
2014-12-01 18:43:46
>>> c.clock.year
2014

@joshvillbrandt
Copy link
Owner

Oh, nice!

So the HERO4 has brought an entirely new API that the HERO3 and HERO3+ don't have. I currently don't support any of the new HERO4 API in this library yet. However, it seems like the HERO4 still supports the old API.

I just recently found the camera name and firmware strings for the HERO3/HERO3+ API which were all in hex, so I wouldn't be surprised if the old API has the timestamp as well. If I can find it in the old API, then we'll be able to get the information for all three camera generations.

@DenisCarriere
Copy link
Author

Awesome, this gopro API is like a treasure hunt!! You will keep finding new
clues every day! It's actually pretty fun!
On Dec 1, 2014 9:50 PM, "Josh Villbrandt" notifications@github.com wrote:

Oh, nice!

So the HERO4 has brought an entirely new API that the HERO3 and HERO3+
don't have. I currently don't support any of the new HERO4 API in this
library yet. However, it seems like the HERO4 still supports the old API.

I just recently found the camera name and firmware strings for the
HERO3/HERO3+ API which were all in hex, so I wouldn't be surprised if the
old API has the timestamp as well. If I can find it in the old API, then
we'll be able to get the information for all three camera generations.


Reply to this email directly or view it on GitHub
#5 (comment)
.

@joshvillbrandt
Copy link
Owner

Hmm, I wasn't able to find something that resembles a timestamp in the four HTTP endpoints that I know about. There might be an endpoint I haven't found yet though. Do you know if the GoPro iOS and Android apps can get (or set?) the time on the HERO3 and HERO3+ cameras? If so, one could listen in with a packet analyzer (Wireshark) to figure out what the additional endpoint is.

@joshvillbrandt
Copy link
Owner

By the way, check out the byte-stream dump in MockGoPro.py. I quickly decoded these from hex to see if any useful information came out. Nothing except for camera/cv showed anything useful.

@DenisCarriere
Copy link
Author

Don't know exactly how to use that MockGoPro.py, but I'll try to install
WireShark on my Android, I need to Root my phone to have access to the
info. Never root my phone before, I will Google it ;)

~~~~~~

Twitter: @DenisCarriere
GitHub: DenisCarriere

On Mon, Dec 1, 2014 at 11:45 PM, Josh Villbrandt notifications@github.com
wrote:

By the way, check out the byte-stream dump in MockGoPro.py
25b77d6#diff-024f63d154301bf1078585137542893a.
I quickly decoded these from hex to see if any useful information came out.
Nothing except for camera/cv showed anything useful.


Reply to this email directly or view it on GitHub
#5 (comment)
.

@joshvillbrandt
Copy link
Owner

Since I wasn't able to find anything that resembled a date string, I'm closing this as not possible - at least not for the GoPro 2, 3, and 3+ endpoints that I know about. Feel free to reopen if you think you've found something.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants