From 92b08170f2a3dc6842f87ae05505c84198234ce6 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Tue, 10 Mar 2020 21:53:43 +0100 Subject: [PATCH] Changed CSV variable, only write Exif tags that hava values to fill in. --- functions.py | 4 +++- rad_tag.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/functions.py b/functions.py index 7f41ba0..539a569 100644 --- a/functions.py +++ b/functions.py @@ -61,7 +61,9 @@ class Photo: # Create metadata object with all data to write for key, value in zip(keys, values): - metadata[key] = pyexiv2.ExifTag(key, value) + # Only create object if there is anything to fill with + if value is not None: + metadata[key] = pyexiv2.ExifTag(key, value) # Write Exif tags to file, if not in dry-run mode if dry_run == 'True': diff --git a/rad_tag.py b/rad_tag.py index 6b14f8e..eec245a 100755 --- a/rad_tag.py +++ b/rad_tag.py @@ -56,10 +56,10 @@ position_list = [] # Import GeigerCounter log with open(args.csv, "r") as f: - csv_reader = csv.reader(filter(lambda row: row[0] != '#', f), - delimiter=',', skipinitialspace=True) + csv = csv.reader(filter(lambda row: row[0] != '#', f), + delimiter=',', skipinitialspace=True) - for _, csv_raw_time, csv_raw_cpm, _ in csv_reader: + for _, csv_raw_time, csv_raw_cpm, _ in csv: radiation = Radiation(csv_raw_time, csv_raw_cpm, local_timezone, args.sifactor) radiation_list.append(radiation) #print(radiation_list)