Moved copying of photos to functions.py, simplified decision whether to copy photo or not.
This commit is contained in:
25
rad_tag.py
25
rad_tag.py
@@ -6,8 +6,6 @@ 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 '''
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import csv
|
||||
import argparse
|
||||
import pytz
|
||||
@@ -91,30 +89,13 @@ else:
|
||||
print('Modifying photos in', str(args.outdir), '(copy)')
|
||||
|
||||
for src_photo in args.photos:
|
||||
# Get image file name out of path
|
||||
photo_basename = os.path.basename(src_photo)
|
||||
|
||||
# Decide whether to modify photo in place or to copy it to outdir first
|
||||
# Then set the destination file as 'photo' to work on
|
||||
if args.outdir == ".":
|
||||
photo = src_photo
|
||||
else:
|
||||
# Be os aware and use the correct directory delimiter for destfile
|
||||
dst_photo = os.path.join(args.outdir, photo_basename)
|
||||
# Don't copy image if in dry-run mode
|
||||
if args.dry == 'True':
|
||||
shutil.copy(src_photo, dst_photo)
|
||||
photo = dst_photo
|
||||
else:
|
||||
photo = src_photo
|
||||
|
||||
pic_aware_time = Photo(photo, local_timezone)
|
||||
print(photo_basename, pic_aware_time)
|
||||
photo = Photo(src_photo, local_timezone, args.outdir, args.dry)
|
||||
print(photo)
|
||||
|
||||
# Here the matching magic has to happen
|
||||
|
||||
# Write exif data
|
||||
# exif_tags = Photo.write_exif(radiation, latitude, longitude, args.dry)
|
||||
# exif_tags = Photo.write_exif(photo, radiation, latitude, longitude, args.dry)
|
||||
# print(exif_tags)
|
||||
|
||||
# Print table header
|
||||
|
Reference in New Issue
Block a user