Added more code-comments and shorted a line that was too long.
This commit is contained in:
parent
f8ed12e35b
commit
e6be76a732
@ -42,17 +42,20 @@ for photo in args.photos:
|
||||
# Load Image and EXIF data
|
||||
im = Image.open(photo)
|
||||
exif_dict = piexif.load(im.info['exif'])
|
||||
# Get image file name out of path
|
||||
photo_basename = os.path.basename(photo)
|
||||
|
||||
# Import GeigerCounter log
|
||||
with open(args.csv, "r") as f:
|
||||
csvreader = csv.reader(filter(lambda row: row[0]!='#', f), delimiter=',', skipinitialspace=True)
|
||||
csvreader = csv.reader(filter(lambda row: row[0] != '#', f),
|
||||
delimiter=',', skipinitialspace=True)
|
||||
|
||||
picrawtime = exif_dict['Exif'][piexif.ExifIFD.DateTimeOriginal].decode('ASCII')
|
||||
picisotime = datetime.strptime(picrawtime, "%Y:%m:%d %H:%M:%S")
|
||||
print('Processing file:', photo_basename, end='\r')
|
||||
for _, csvrawtime, csvrawcpm, _ in csvreader:
|
||||
csvisotime = datetime.fromisoformat(csvrawtime)
|
||||
# Process image if its timestamp is found in CSV log
|
||||
if csvisotime == picisotime:
|
||||
rad = round(float(csvrawcpm) * args.sifactor, 2)
|
||||
|
||||
@ -72,4 +75,5 @@ for photo in args.photos:
|
||||
break
|
||||
else:
|
||||
print('{:<30} {:<20} {:<22}'.format(photo_basename, str(picisotime), 'NOT FOUND!'))
|
||||
# close CSV file
|
||||
f.close()
|
||||
|
Loading…
Reference in New Issue
Block a user