45
« on: August 21, 2018, 06:07:34 AM »
Hi Alexey,
Thank you! That script helps hugely! I now can split by time, however I'm still not proficient to split and move them into different chunk, or automatically split dictionary into chunks. However I can manually right click and move to new chunk. Just noticed one thing is when I move to new chunk the other photos just moved in chunk2, if I don't click in the reference panel to cancel selected images (when I'm in chunk 1), the images in chunk 2 will be moved together with the ones selected in chunk 1 to the new chunk.
My crappy codes are:
import PhotoScan, time
STEP = 60 #seconds
chunk = PhotoScan.app.document.chunk
cameras = dict()
for camera in chunk.cameras:
cameras[time.mktime(time.strptime(camera.photo.meta['Exif/DateTime'], '%Y:%m:%d %H:%M:%S'))] = camera
# print('camera',camera)
# print(cameras[time.mktime(time.strptime(camera.photo.meta['Exif/DateTime'], '%Y:%m:%d %H:%M:%S'))])
#print('Camera', cameras)
chunkcamera = chunk.cameras
sorted_by_time = list(cameras.keys())
sorted_by_time.sort()
chunk_1 = dict()
chunk_2 = dict()
chunk_3 = dict()
chunk_4 = dict()
chunk_5 = dict()
tmpdict = dict()
chunk_initial = 1
for i in range(0, len(cameras)-1):
tmpkey = []
tmpkey = sorted_by_time[i]
if sorted_by_time[i] - sorted_by_time[i-1] < STEP and chunk_initial < 6:
if chunk_initial == 1:
# print(cameras[1])
# chunk_1.update((k,cameras[k]) for k in tmpkey)
cameras[sorted_by_time[i]].selected = True
else:
cameras[sorted_by_time[i]].selected = False
elif sorted_by_time[i] - sorted_by_time[i-1] > STEP and chunk_initial < 6:
chunk_initial += 1
else:
print('More than 5 chunks, needs increase chunks')
Thanks a lot!