#shootIBL
import sys
# sys.path.append("/storage/emulated/0/Documents/Pystuff/OpenSphericalCamera/osc")
sys.path.append("D:/projects/IBL_research/OpenSphericalCamera/python\osc")
print(sys.version_info[0])

from osc.insta360 import insta360
import json
import pprint

c = insta360()

'''
    # exposure program values:
    # 0 = Not defined
    # 1 = Manual
    # 4 = Shutter priority
    # 9 = ISO priority

'''
shutterSpeeds = [
    0.00002,
    0.00004,
    0.000125,
    0.00025,
    0.0005,
    0.001,
    0.002,
    0.004,
    0.008,
    0.01666666,
    0.03333333,
    0.06666666,
    0.125,
    0.25,
    0.5,
    1,
    2
]
def echoInfo():
    print(c.info())

def shootBracketsWithExposureCompensation():
    c.info()
    c.state()

    c.setOption("captureMode", "image")
    c.setOption("iso", 100)
    c.setOption("shutterSpeed", 0.000125)
    c.setOption("whiteBalance", "cloudy-daylight")
    c.setOption("exposureProgram", 4) 

    for i in range(-8,10,2):
        print(i)
        print(c.setOption("exposureCompensation", i))
        response = c.takePicture()

def shootBrackets():
    c.info()
    c.state()

    c.setOption("captureMode", "image")
    c.setOption("exposureProgram", 1) 
    c.setOption("iso", 100)
    c.setOption("whiteBalance", "cloudy-daylight")
    

    for i in shutterSpeeds:
        print(i)
        print(c.setOption("shutterSpeed", i))
        response = c.takePicture()
        print(response)

shootBrackets()
# echoInfo()