In [1]:
import os
import time
import IPython
import ipywidgets
import data_io
from progress_bar import bar
import context
import gopro_helper as gopro
In [2]:
%load_ext autoreload
%autoreload 2
In [3]:
wid = gopro.GoProSettings()
In [4]:
wid.initialize()
In [7]:
wid.mode
Out[7]:
In [17]:
wid.set_mode_video()
In [9]:
wid.update_information()
In [20]:
wid.update_widgets()
In [13]:
gopro.commands.set_mode_video()
In [8]:
gopro.commands.set_mode_photo()
In [14]:
wid.update_information()
In [10]:
wid.update_information()
In [ ]:
wid._wid_box._
In [60]:
wid._wid_box.children=[]
In [55]:
status, settings = gopro.commands.get_raw_status_settings()
mode = gopro.status.current_mode(status)
mode
Out[55]:
In [32]:
fid = gopro.api._feature_id.video.FPS
fid
Out[32]:
In [33]:
name = gopro.api.feature_id_name(mode, fid)
name
Out[33]:
In [7]:
name, options = gopro.api.feature_choices('video', 4, include_empty=True)
name, options
Out[7]:
In [13]:
options['sf']=6
In [16]:
import numpy as np
In [17]:
np.sort(options)
In [35]:
value = 10
In [36]:
resp = gopro.commands.set_feature_value(fid, value)
In [43]:
w = gopro.feature_dropdown_widget(mode, fid, name)
In [44]:
w
In [54]:
w.value
Out[54]:
In [56]:
settings
Out[56]:
In [34]:
resp = gopro.commands.set_feature_value(fid, 4)
In [29]:
url = gopro.api.tpl_setting.format(feature=fid, value=0)
print(url)
In [20]:
# def feature_value(fid):
# mode = gopro.status.current_mode()
# assert(mode == fid_mode(fid))
# value_init = feature_current_value(fid)
# wid_feature = select_feature_widget(fid, value_init=value_init)
# def handle_feature_selection(event):
# value = event.new
# # print('set {} {}'.format(fid, value))
# set_feature_value(fid, value)
# wid_feature.observe(handle_feature_selection, names='value')
# IPython.display.display(wid_feature)
In [ ]:
In [ ]:
In [39]:
gopro.commands.shutter_capture()
time_max = 5
interval = 0.05
time_start = time.time()
while time.time() - time_start < time_max:
time_pre = time.time()
stat = gopro.status.fetch_camera_info(pretty=False)
time_after = time.time()
delta = time_after - time_pre
time_sleep = interval - delta
if stat['System']['system_busy'] > 0:
if time_sleep > 0.001:
time.sleep(time_sleep)
else:
break
print('{:.3f} sec'.format(time_after - time_start))
In [ ]:
In [19]:
gopro.commands.set_mode_photo()
In [16]:
gopro.commands.set_mode_video()
In [53]:
gopro.commands.shutter_capture()
In [52]:
gopro.commands.shutter_stop()
In [51]:
gopro.commands.update_local_data(delete=True)
In [ ]: