"""
{
  "name": "Exposure Compensation bracket",
  "description": "",
  "ui": [ {
    "name":        "num_photos",
    "label":       "Number of photos",
    "type":        "integer",
    "ui":          "spinbox",
    "value":       3,
    "description": "Total number of photos to take, while increasing the exposure compenstion for each one"
  } ]
}
"""

import smartshooter

ctx = smartshooter.Context()

original_ev = ctx.get_property(smartshooter.Property.Exposure)
ev_range = ctx.get_property_range(smartshooter.Property.Exposure)

i = 1
for ev in ev_range:
    value = float(ev)
    if value >= float(original_ev):
        print("Taking photo {} with exposure compensation = {}".format(i, ev))
        i += 1
        ctx.set_property(smartshooter.Property.Exposure, ev)
        ctx.shoot()
    if i > int(num_photos):
        break

ctx.set_property(smartshooter.Property.Exposure, original_ev)
