-
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Konrad Iturbe
committed
Jul 7, 2019
1 parent
0fcd8c9
commit e283a8f
Showing
9 changed files
with
245 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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!\nVideo Id: %s\nStatus: %s" % | ||
(videoId, gpCam.clipStatus(str(videoId)))) | ||
time.sleep(1) | ||
while(gpCam.clipStatus(str(videoId)) != "complete"): | ||
time.sleep(1) | ||
time.sleep(2) | ||
print("Downloading!\nVideo Id: %s\nStatus: %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"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python setup.py install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
### Testing: | ||
|
||
Connect a fully-charged HERO5 Black with an SD card to your PC and run the tests. | ||
|
||
python main.py | ||
|
||
|
||
```` | ||
konrad@konrad-pc [tests (dev)]: python main.py | ||
test_has_sd_card (__main__.MainTests) ... Needs an SD card | ||
HERO5 Black | ||
HD5.02.02.60.00 | ||
Camera successfully connected! | ||
ok | ||
test_photo_mode (__main__.MainTests) ... PHOTO MODE | ||
HERO5 Black | ||
HD5.02.02.60.00 | ||
Camera successfully connected! | ||
ok | ||
test_power_off (__main__.MainTests) ... POWER OFF | ||
HERO5 Black | ||
HD5.02.02.60.00 | ||
Camera successfully connected! | ||
ok | ||
test_power_on (__main__.MainTests) ... POWER ON | ||
Waking up... | ||
Waking up... | ||
ok | ||
test_recording_status (__main__.MainTests) ... isRecording | ||
HERO5 Black | ||
HD5.02.02.60.00 | ||
Camera successfully connected! | ||
ok | ||
test_shoot_video (__main__.MainTests) ... shoot_video(5) | ||
HERO5 Black | ||
HD5.02.02.60.00 | ||
Camera successfully connected! | ||
ok | ||
test_shutter (__main__.MainTests) ... SHUTTER START | ||
HERO5 Black | ||
HD5.02.02.60.00 | ||
Camera successfully connected! | ||
ok | ||
test_take_photo (__main__.MainTests) ... take_photo() | ||
HERO5 Black | ||
HD5.02.02.60.00 | ||
Camera successfully connected! | ||
ok | ||
test_video_mode (__main__.MainTests) ... VIDEO MODE | ||
HERO5 Black | ||
HD5.02.02.60.00 | ||
Camera successfully connected! | ||
ok | ||
---------------------------------------------------------------------- | ||
Ran 9 tests in 87.454s | ||
OK | ||
```` | ||
|
Empty file.
Oops, something went wrong.