Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fjord-cam
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Field Science
fjord-cam
Commits
085b3407
Commit
085b3407
authored
2 years ago
by
Demo User
Browse files
Options
Downloads
Patches
Plain Diff
add gopro version
parent
42e3d20c
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gopro_capture.py
+55
-0
55 additions, 0 deletions
gopro_capture.py
with
55 additions
and
0 deletions
gopro_capture.py
0 → 100644
+
55
−
0
View file @
085b3407
import
subprocess
import
json
import
requests
import
time
from
datetime
import
datetime
def
runcmd
(
cmd
,
verbose
=
False
,
*
args
,
**
kwargs
):
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
text
=
True
,
shell
=
True
)
std_out
,
std_err
=
process
.
communicate
()
return
std_out
def
take_single
():
# Take single Image
runcmd
(
'
wget
"
http://10.5.5.9/bacpac/SH?t=goprohero&p=%01
"
-O /dev/null
'
,
verbose
=
True
)
time
.
sleep
(
5
)
# Wait for image to write
# Get file list
output
=
runcmd
(
'
curl
"
10.5.5.9:8080/gp/gpMediaList
"'
,
verbose
=
True
)
filelist
=
json
.
loads
(
output
)
d
=
filelist
[
"
media
"
][
0
][
'
d
'
]
f
=
filelist
[
"
media
"
][
0
][
'
fs
'
][
-
1
][
'
n
'
]
image_url
=
"
http://10.5.5.9:8080/videos/DCIM/
"
+
d
+
"
/
"
+
f
img_data
=
requests
.
get
(
image_url
).
content
now
=
datetime
.
now
()
current_time
=
now
.
strftime
(
"
%H:%M:%S
"
)
print
(
"
Collected
"
+
image_url
+
"
(
"
+
current_time
+
"
)
"
)
with
open
(
"
img/
"
+
f
,
'
wb
'
)
as
handler
:
handler
.
write
(
img_data
)
time
.
sleep
(
5
)
# Wait for image to transfer
# Remove all Images from SD
runcmd
(
'
wget
"
http://10.5.5.9/camera/DA?t=goprohero
"
-O /dev/null
'
,
verbose
=
True
)
time
.
sleep
(
5
)
def
main
():
count
=
100
for
x
in
range
(
count
):
take_single
()
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment