Created Radiation, Photo classes and slimmed down main program.

- Radiation creates a list with timezone_aware datetime and radiation in µS/h.
- Photo reads DateTimeOriginal from photo.
- Photo.write_exif compiles new metadata object and writes exif tags to photo.
- Documentd changes in CHANGELOG.md.
- Changed Readme.me to match changes in code.
- Removed obsolete line from .gitignore
This commit is contained in:
2020-03-10 21:09:25 +01:00
parent d347bbdf55
commit c19a94374e
5 changed files with 75 additions and 29 deletions

View File

@@ -1,20 +1,18 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Iterates over a bunch of .jpg or .cr2 files and matches
''' Iterates over a bunch of .jpg or .cr2 files and matches
DateTimeOriginal from Exif tag to DateTime in a csv log
of a GeigerMuellerCounter and writes its value to the UserComment
Exif tag in µS/h"""
Exif tag in µS/h '''
from datetime import datetime, timedelta
import os
import shutil
import csv
import argparse
import pytz
import pyexiv2
import gpxpy
from functions import Radiation
from functions import Radiation, Photo
# SIFACTOR for GQ Geiger counters
@@ -110,14 +108,14 @@ for src_photo in args.photos:
else:
photo = src_photo
# Load Exif data from image
metadata = pyexiv2.ImageMetadata(photo)
metadata.read()
tag = metadata['Exif.Photo.DateTimeOriginal']
# tag.value creates datetime object in pictime
pic_naive_time = tag.value
# Set timezone
pic_time = pic_naive_time.astimezone(local_timezone)
pic_aware_time = Photo(photo, local_timezone)
print(photo_basename, pic_aware_time)
# Here the matching magic has to happen
# Write exif data
# exif_tags = Photo.write_exif(radiation, latitude, longitude, args.dry)
# print(exif_tags)
# Print table header
print('{:<15} {:<25} {:<22}'.format('filename', 'date / time', 'Exif UserComment'))