KonradIT / goprowifihack

Unofficial GoPro WiFi API Documentation - HTTP GET requests for commands, status, livestreaming and media query.
Apache License 2.0
2.12k stars 335 forks source link

Getting date and time from GoPro camera #187

Open rudyryk opened 4 years ago

rudyryk commented 4 years ago

Problem:

Newer GoPro models (now sure what models are capable exactly) provide date and time in status. But there's no method to get it via inteface naturally.

Details:

Here's the snippet to get the date and time:

import json
import datetime
from goprocam import GoProCamera, constants
goproCamera = GoProCamera.GoPro()
status = json.loads(goproCamera.getStatusRaw()).get('status')
status_time = status.get('40', [])[1:].split('%')
time_parts = [int(item, 16) for item in status_time]
if time_parts:
    time_parts[0] += 2000
    print(datetime.datetime(*time_parts))

So, we actually can parse the key '40' from status in a specific manner to get the date & time.

It would be great to have an interface method for that.

Thank you for developing and maintaining this great project!

danhd123 commented 4 years ago

I think status_time[0...2] are base 16, [3...5] are base 10.