Hello magic,
I have updated the second part of the script - now it splits the cameras to the groups inside the single (active) chunk:
doc = PhotoScan.app.document
chunk = doc.addChunk()
chunk.label = "New Chunk"
# Ajout de photos -add photos 1st chunk
path_photos = PhotoScan.app.getExistingDirectory("main folder:")
image_list = os.listdir(path_photos)
photo_list = list()
for photo in image_list:
if photo.rsplit(".",1)[1].lower() in ["jpg", "jpeg", "tif", "tiff"]:
photo_list.append("/".join([path_photos, photo]))
chunk.addPhotos(photo_list)
print("- Photos ajoutées")
time_table = list()
for camera in chunk.cameras:
time = camera.photo.meta['Exif/DateTimeOriginal'].split(" ")[1][:-3].replace(":", ".")
time = float(time)
time = time // 1 + (time - time // 1) * 100 / 60
time_table.append(time)
time_table.sort()
limits = (time_table[0], time_table[-1])
interval = 5 / 60. #five minute interval
start = limits[0]
while True:
empty = True
new_group = chunk.addCameraGroup()
finish = start + interval
new_group.label = "{:d}:{:d} - {:d}:{:d}".format(int(start // 1), int((start - start // 1) * 60),
int(finish // 1), int((finish - finish // 1) * 60))#####
for camera in list(chunk.cameras):
time = float(camera.photo.meta['Exif/DateTimeOriginal'].split(" ")[1][:-3].replace(":", "."))
time = time // 1 + (time - time // 1) * 100 / 60
if start <= time < start + interval:
camera.group = new_group
empty = False
start += interval
if empty:
chunk.remove(new_group)
if start > limits[-1]:
break
print("script finished")