From e6be76a73293159d6a3082f5c60a15131db31f37 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Wed, 4 Mar 2020 11:15:58 +0100 Subject: [PATCH] Added more code-comments and shorted a line that was too long. --- exif_rad.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exif_rad.py b/exif_rad.py index 13b8f08..8a1c258 100755 --- a/exif_rad.py +++ b/exif_rad.py @@ -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()