Commit 23246920 authored by Tony Mai's avatar Tony Mai

add files

parent f738737f
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.
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
from goprocam import GoProCamera
from goprocam import constants
gpCam = GoProCamera.GoPro()
while True:
TIMER=10
gpCam.downloadLastMedia(gpCam.take_photo(TIMER)) #10 second timelapse.
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)
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
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"))
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
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")))
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")
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))
from goprocam import GoProCamera
from goprocam import constants
import time
gpCam = GoProCamera.GoPro(constants.auth)
gpCam.overview()
gpCam.listMedia(True)
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")
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
from goprocam import GoProCamera
from goprocam import constants
import time
gpCam = GoProCamera.GoPro()
print(gpCam.take_photo(10))
This diff is collapsed.
from goprocam import GoProCamera
from goprocam import constants
\ No newline at end of file
This diff is collapsed.
class CameraNotConnected(Exception):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment