Forum

Author Topic: Find and select cameras by time in chunk  (Read 1918 times)

magic

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Find and select cameras by time in chunk
« on: May 17, 2018, 02:55:28 PM »
Hi team
I have some script and I can see time all my cameras in chunk(ex 10.59,10.59,10.59,11.00,11.00 etc) , what I want to do is to find and select only the images with specific time for example , cameras been taken at 10am to 4pm , and I want only work with cameras with been taken at 1am05 to 1am25 , and selected them how we can do it it is possible, and I have some error message with split...
AttributeError: 'NoneType' object has no attribute 'split'
2018-05-17 14:08:56 Error: 'NoneType' object has no attribute 'split'
Code: [Select]
import os, PhotoScan

chunk = PhotoScan.app.document.chunk
time_table = list()
for camera in chunk.cameras:
    time = camera.photo.meta['Exif/DateTimeOriginal'].split(" ")[1][:-3].replace(":", ".")
    time_table.append(time)
    time_table.sort()
time_table.sort()
print(time_table)
Thaths what I have for now , any body can help please???
« Last Edit: May 18, 2018, 12:52:46 PM by magic »

magic

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Find cameras by time
« Reply #1 on: May 17, 2018, 03:31:56 PM »
I've added it and still have an error
Code: [Select]
import os, PhotoScan

chunk = PhotoScan.app.document.chunk
time_table = list()
for camera in chunk.cameras:
    time = float(camera.photo.meta['Exif/DateTimeOriginal'].split(" ")[1][:-3].replace(":", "."))
    time = time // 1 + (time  - time // 1) * 100 / 60
    time_table.append(time)
    #time_table.sort()
    print(time_table)
time_table.sort()
limits = (time_table[0], time_table[-1])
interval = 08.03
interval1 = 08.05
start = limits[0]
    #interval2 = interval + interval1
    #time = time // 1 + time  - time // 1
while True:
    finish = start + interval1
    if start <= time < start + interval1:
        camera.selected = True
Someone know what Im doing wrong
It doesn't work, help please  :-[ :-[
« Last Edit: May 17, 2018, 06:10:39 PM by magic »

magic

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Find cameras by time
« Reply #2 on: May 18, 2018, 09:54:11 AM »
I've trying to modify it and still nothing  :-\ , did somebody can check it please have a lot images to do , and Im stuck with and have to finish it today  :-\, Alexey are You there my god of python ??
Code: [Select]
import os, PhotoScan
import datetime
chunk = PhotoScan.app.document.chunk
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])
    #limits = time[0], time[-1]
    interval = 08.02
    interval1 = 08.03
    start = limits[0]
    while True:
        finish = start + interval
        time = float(camera.photo.meta['Exif/DateTimeOriginal'].split(" ")[1][:-3].replace(":", "."))
        time = time // 1 + (time  - time // 1) * 100 / 60

        if start <= time < start + interval1:
            camera.selected = True
            empty = False

    start += interval
« Last Edit: May 18, 2018, 10:44:38 AM by magic »

magic

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Find and select cameras by time need help Alexey :-)
« Reply #3 on: May 18, 2018, 12:52:24 PM »
I'ts ok I've got it  ;)
Code: [Select]
import os, PhotoScan
import datetime
chunk = PhotoScan.app.document.chunk
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
    interval = 08.03
    interval1 = 08.05
    start = interval
    if start <= time <= interval1:
        #print(start,time,interval1)
        camera.selected = True