Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
gopro
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tony Mai
gopro
Commits
23246920
Commit
23246920
authored
Jul 22, 2019
by
Tony Mai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add files
parent
f738737f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
2521 additions
and
0 deletions
+2521
-0
download_pic_in_4s.py
fusion/py-api/examples/download_pic_in_4s.py
+6
-0
download_tags.py
fusion/py-api/examples/download_tags.py
+20
-0
download_timelapse.py
fusion/py-api/examples/download_timelapse.py
+7
-0
download_today.py
fusion/py-api/examples/download_today.py
+36
-0
download_video.py
fusion/py-api/examples/download_video.py
+12
-0
dump_info.py
fusion/py-api/examples/dump_info.py
+9
-0
dump_sdcard.py
fusion/py-api/examples/dump_sdcard.py
+7
-0
extract_clips.py
fusion/py-api/examples/extract_clips.py
+43
-0
hdrphoto.py
fusion/py-api/examples/hdrphoto.py
+32
-0
hero3_tests.py
fusion/py-api/examples/hero3_tests.py
+24
-0
list_media_example.py
fusion/py-api/examples/list_media_example.py
+6
-0
stored_timelapse.py
fusion/py-api/examples/stored_timelapse.py
+9
-0
tagging-save.py
fusion/py-api/examples/tagging-save.py
+17
-0
take_photo_10sec.py
fusion/py-api/examples/take_photo_10sec.py
+6
-0
GoProCamera.py
fusion/py-api/goprocam/GoProCamera.py
+1450
-0
__init__.py
fusion/py-api/goprocam/__init__.py
+2
-0
constants.py
fusion/py-api/goprocam/constants.py
+833
-0
exceptions.py
fusion/py-api/goprocam/exceptions.py
+2
-0
No files found.
fusion/py-api/examples/download_pic_in_4s.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
gpCam
=
GoProCamera
.
GoPro
()
TIMER
=
4
gpCam
.
downloadLastMedia
(
gpCam
.
take_photo
(
TIMER
))
#take a photo in 4 seconds and download it.
fusion/py-api/examples/download_tags.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
,
constants
gopro
=
GoProCamera
.
GoPro
()
## Downloads the video between 2 hilight tags
last_media
=
gopro
.
getMedia
()
if
last_media
.
endswith
(
".MP4"
):
folder
=
gopro
.
getMediaInfo
(
"folder"
)
file
=
gopro
.
getMediaInfo
(
"file"
)
number_of_tags
=
gopro
.
getVideoInfo
(
"tag_count"
,
file
,
folder
)
if
number_of_tags
!=
0
and
number_of_tags
%
2
==
0
:
#Even number of tags
tags
=
gopro
.
getVideoInfo
(
"tags"
,
file
,
folder
)
print
(
tags
)
status_id
=
gopro
.
getClip
(
folder
+
"/"
+
file
,
constants
.
Clip
.
R720p
,
constants
.
Clip
.
FPS_NORMAL
,
str
(
tags
[
0
]),
str
(
tags
[
1
]))
url
=
gopro
.
clipStatus
(
str
(
status_id
))
while
gopro
.
getClipURL
(
str
(
status_id
))
==
None
:
gopro
.
getClipURL
(
str
(
status_id
))
print
(
gopro
.
getClipURL
(
str
(
status_id
)))
gopro
.
downloadLastMedia
(
path
=
gopro
.
getClipURL
(
str
(
status_id
)),
custom_filename
=
gopro
.
getInfoFromURL
(
gopro
.
getClipURL
(
str
(
status_id
)))[
1
])
print
(
"Downloaded."
)
\ No newline at end of file
fusion/py-api/examples/download_timelapse.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
gpCam
=
GoProCamera
.
GoPro
()
while
True
:
TIMER
=
10
gpCam
.
downloadLastMedia
(
gpCam
.
take_photo
(
TIMER
))
#10 second timelapse.
fusion/py-api/examples/download_today.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
,
constants
import
argparse
import
datetime
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--video'
,
"-v"
,
help
=
'Download videos only'
,
required
=
False
,
type
=
bool
)
parser
.
add_argument
(
'--photo'
,
"-p"
,
help
=
'Download photos only'
,
required
=
False
,
type
=
bool
)
parser
.
add_argument
(
'--all'
,
"-a"
,
help
=
'Download all'
,
required
=
False
,
type
=
bool
)
parser
.
add_argument
(
'--out'
,
"-o"
,
help
=
'Output path'
,
default
=
""
)
args
=
parser
.
parse_args
()
gopro
=
GoProCamera
.
GoPro
()
medialist
=
gopro
.
listMedia
(
format
=
True
,
media_array
=
True
)
currentdate
=
datetime
.
datetime
.
today
()
.
date
()
if
args
.
video
:
for
media
in
medialist
:
dat
=
datetime
.
datetime
.
fromtimestamp
(
int
(
media
[
3
]))
.
date
()
if
"MP4"
in
media
[
1
]
and
dat
==
currentdate
:
newpath
=
args
.
out
+
"/"
+
media
[
1
]
gopro
.
downloadMedia
(
media
[
0
],
media
[
1
],
newpath
)
if
args
.
photo
:
for
media
in
medialist
:
dat
=
datetime
.
datetime
.
fromtimestamp
(
int
(
media
[
3
]))
.
date
()
if
"JPG"
in
media
[
1
]
and
dat
==
currentdate
:
newpath
=
args
.
out
+
"/"
+
media
[
1
]
gopro
.
downloadMedia
(
media
[
0
],
media
[
1
],
newpath
)
if
args
.
all
:
for
media
in
medialist
:
dat
=
datetime
.
datetime
.
fromtimestamp
(
int
(
media
[
3
]))
.
date
()
if
dat
==
currentdate
:
newpath
=
args
.
out
+
"/"
+
media
[
1
]
gopro
.
downloadMedia
(
media
[
0
],
media
[
1
],
newpath
)
fusion/py-api/examples/download_video.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
,
constants
import
time
gpCam
=
GoProCamera
.
GoPro
()
videos_duration
=
[
10
,
30
,
60
,
120
,
180
]
gpCam
.
video_settings
(
"1080p"
,
"60"
)
gpCam
.
gpControlSet
(
constants
.
Video
.
PROTUNE_VIDEO
,
constants
.
Video
.
ProTune
.
ON
)
for
i
in
videos_duration
:
print
(
"Recording "
+
str
(
i
)
+
" seconds video"
)
gpCam
.
downloadLastMedia
(
gpCam
.
shoot_video
(
i
),
custom_filename
=
"VIDEO_"
+
str
(
i
)
+
".MP4"
)
time
.
sleep
(
2
)
\ No newline at end of file
fusion/py-api/examples/dump_info.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
## Test 1: Dump all info
gpCam
=
GoProCamera
.
GoPro
()
print
(
gpCam
.
getStatus
(
constants
.
Status
.
Status
,
constants
.
Status
.
STATUS
.
Mode
))
print
(
gpCam
.
getStatusRaw
())
print
(
gpCam
.
infoCamera
(
constants
.
Camera
.
Name
))
print
(
gpCam
.
getMedia
())
print
(
gpCam
.
getMediaInfo
(
"file"
))
fusion/py-api/examples/dump_sdcard.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
,
constants
gpCam
=
GoProCamera
.
GoPro
()
## Downloads all of the SD card's contents and then formats the sd card.
gpCam
.
downloadAll
()
gpCam
.
delete
(
"all"
)
\ No newline at end of file
fusion/py-api/examples/extract_clips.py
0 → 100644
View file @
23246920
import
time
import
numpy
as
np
from
goprocam
import
GoProCamera
,
constants
gpCam
=
GoProCamera
.
GoPro
()
# Extracts clips from latest video
latestVideo
=
gpCam
.
getVideoInfo
()
print
(
"Tag count
%
s"
%
latestVideo
.
get
(
constants
.
Info
.
TagCount
))
arrayLength
=
latestVideo
[
constants
.
Info
.
TagCount
]
if
arrayLength
%
2
==
0
:
print
(
"Matching tag pairs!"
)
splitArray
=
np
.
array_split
(
latestVideo
[
constants
.
Info
.
Tags
],
arrayLength
/
2
)
for
tag
in
splitArray
:
startMs
=
tag
[
0
]
stopMs
=
tag
[
1
]
print
(
"
\n
[START ms]
%
s
\n
[STOP ms]
%
s"
%
(
startMs
,
stopMs
))
fileName
=
"
%
s/
%
s"
%
(
gpCam
.
getMediaInfo
(
"folder"
),
gpCam
.
getMediaInfo
(
"file"
))
videoId
=
gpCam
.
getClip
(
fileName
,
constants
.
Clip
.
R1080p
,
constants
.
Clip
.
FPS_NORMAL
,
str
(
startMs
),
str
(
stopMs
))
print
(
"On queue!
\n
Video Id:
%
s
\n
Status:
%
s"
%
(
videoId
,
gpCam
.
clipStatus
(
str
(
videoId
))))
time
.
sleep
(
1
)
while
(
gpCam
.
clipStatus
(
str
(
videoId
))
!=
"complete"
):
time
.
sleep
(
1
)
time
.
sleep
(
2
)
print
(
"Downloading!
\n
Video Id:
%
s
\n
Status:
%
s"
%
(
videoId
,
gpCam
.
clipStatus
(
str
(
videoId
))))
url
=
gpCam
.
getClipURL
(
str
(
videoId
))
download
=
[
url
.
split
(
"/"
)[
len
(
url
.
split
(
"/"
))
-
1
],
url
.
split
(
"/"
)[
len
(
url
.
split
(
"/"
))
-
2
]]
print
(
"Downloading
%
s"
%
download
)
try
:
gpCam
.
downloadLastMedia
(
path
=
url
,
custom_filename
=
"output/
%
s_
%
s_
%
s"
%
(
startMs
,
stopMs
,
download
[
0
]
.
replace
(
"TRV"
,
"MP4"
)))
except
(
Exception
)
as
e
:
time
.
sleep
(
2
)
gpCam
.
downloadLastMedia
(
path
=
url
,
custom_filename
=
"output/
%
s_
%
s_
%
s"
%
(
startMs
,
stopMs
,
download
[
0
]
.
replace
(
"TRV"
,
"MP4"
)))
fusion/py-api/examples/hdrphoto.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
gopro
=
GoProCamera
.
GoPro
(
constants
.
gpcontrol
)
#HERO4/5 only.
gopro
.
mode
(
constants
.
Mode
.
PhotoMode
,
constants
.
Mode
.
SubMode
.
Photo
.
Single
)
gopro
.
gpControlSet
(
constants
.
Photo
.
PROTUNE_PHOTO
,
constants
.
Photo
.
ProTune
.
ON
)
for
i
in
range
(
0
,
9
):
brackets
=
[
constants
.
Photo
.
EvComp
.
P1
,
constants
.
Photo
.
EvComp
.
Zero
,
constants
.
Photo
.
EvComp
.
M1
]
#Chosen bracketing intervals.
if
str
(
i
)
in
brackets
:
gopro
.
gpControlSet
(
constants
.
Photo
.
EVCOMP
,
str
(
i
))
name
=
""
if
str
(
i
)
==
constants
.
Photo
.
EvComp
.
P2
:
name
=
"Plus_2"
elif
str
(
i
)
==
constants
.
Photo
.
EvComp
.
P1_5
:
name
=
"Plus_1.5"
elif
str
(
i
)
==
constants
.
Photo
.
EvComp
.
P1
:
name
=
"Plus_1"
elif
str
(
i
)
==
constants
.
Photo
.
EvComp
.
P0_5
:
name
=
"Plus_0.5"
elif
str
(
i
)
==
constants
.
Photo
.
EvComp
.
Zero
:
name
=
"ZERO_MAIN"
elif
str
(
i
)
==
constants
.
Photo
.
EvComp
.
M2
:
name
=
"Minus_2"
elif
str
(
i
)
==
constants
.
Photo
.
EvComp
.
M1_5
:
name
=
"Minus_1.5"
elif
str
(
i
)
==
constants
.
Photo
.
EvComp
.
M1
:
name
=
"Minus_1"
elif
str
(
i
)
==
constants
.
Photo
.
EvComp
.
M0_5
:
name
=
"Minus_0.5"
gopro
.
downloadLastMedia
(
gopro
.
take_photo
(),
custom_filename
=
"HDR_"
+
name
+
".jpg"
)
fusion/py-api/examples/hero3_tests.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
gpCam
=
GoProCamera
.
GoPro
(
constants
.
auth
)
gpCam
.
infoCamera
(
"model_name"
)
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
SpotMeter
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
TimeLapseInterval
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
FOV
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
Beep
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
LED
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
AutoOff
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
VideoRes
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
FPS
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
Loop
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
WhiteBalance
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
IsRecording
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
PicRes
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
TimeRecordedMins
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
TimeRecordedSecs
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
Charging
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
PicturesTaken
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
VideoRemaining
))
print
(
gpCam
.
getStatus
(
constants
.
Hero3Status
.
VideosTaken
))
fusion/py-api/examples/list_media_example.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
import
time
gpCam
=
GoProCamera
.
GoPro
(
constants
.
auth
)
gpCam
.
overview
()
gpCam
.
listMedia
(
True
)
fusion/py-api/examples/stored_timelapse.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
gopro
=
GoProCamera
.
GoPro
()
TIMER
=
5
COUNT
=
0
while
True
:
COUNT
+=
1
gopro
.
downloadLastMedia
(
gopro
.
take_photo
(
TIMER
),
"TL"
+
str
(
COUNT
)
+
".jpg"
)
gopro
.
delete
(
"last"
)
fusion/py-api/examples/tagging-save.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
,
constants
import
json
gpCam
=
GoProCamera
.
GoPro
(
constants
.
gpcontrol
)
## This script will download videos from the camera that have hilight tags in them and create a json file containing the tag location in milliseconds with each video
media
=
gpCam
.
listMedia
(
True
,
True
)
for
i
in
media
:
folder
=
i
[
0
]
filename
=
i
[
1
]
if
filename
.
endswith
(
'MP4'
):
tags_in_video
=
gpCam
.
getVideoInfo
(
"tags"
,
filename
,
folder
)
if
not
tags_in_video
==
[]:
gpCam
.
downloadMedia
(
folder
,
filename
)
filename_tags
=
filename
.
replace
(
'MP4'
,
'json'
)
hs
=
open
(
filename_tags
,
"a"
)
hs
.
write
(
str
(
tags_in_video
))
hs
.
close
()
\ No newline at end of file
fusion/py-api/examples/take_photo_10sec.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
import
time
gpCam
=
GoProCamera
.
GoPro
()
print
(
gpCam
.
take_photo
(
10
))
fusion/py-api/goprocam/GoProCamera.py
0 → 100644
View file @
23246920
This diff is collapsed.
Click to expand it.
fusion/py-api/goprocam/__init__.py
0 → 100644
View file @
23246920
from
goprocam
import
GoProCamera
from
goprocam
import
constants
\ No newline at end of file
fusion/py-api/goprocam/constants.py
0 → 100644
View file @
23246920
This diff is collapsed.
Click to expand it.
fusion/py-api/goprocam/exceptions.py
0 → 100644
View file @
23246920
class
CameraNotConnected
(
Exception
):
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment