Made code better readable.
Added verbose instance attributes.
This commit is contained in:
parent
3e5cfcf327
commit
59b94991d0
25
functions.py
25
functions.py
@ -59,10 +59,11 @@ class Photo:
|
||||
|
||||
def __init__(self, photo, local_timezone, dest_dir, dry_run):
|
||||
self.get_date = self._get_creation_date(photo, local_timezone)
|
||||
self.get_target_photo = self._copy_photo(photo, dest_dir, dry_run)
|
||||
self.get_photo_filename = self._copy_photo(photo, dest_dir, dry_run)[1]
|
||||
self.get_photo_basename = self._copy_photo(photo, dest_dir, dry_run)[0]
|
||||
|
||||
def __repr__(self):
|
||||
return 'Photo: %s Creation Date: %s' % (str(self.get_target_photo), str(self.get_date))
|
||||
return 'Photo: %s Creation Date: %s' % (str(self.get_photo_basename), str(self.get_date))
|
||||
|
||||
def _copy_photo(self, photo, dest_dir, dry_run):
|
||||
# Determine where to work on photo and copy it there if needed.
|
||||
@ -106,22 +107,26 @@ class Match:
|
||||
'''
|
||||
|
||||
def __init__(self, photo_time, radiation_list, position_list):
|
||||
self.radiation = self._find_radiation_match(photo_time, radiation_list)
|
||||
self.position = self._find_position_match(photo_time, position_list)
|
||||
self.radiation_value = self._find_radiation_match(photo_time, radiation_list)[1]
|
||||
self.radiation_delta = self._find_radiation_match(photo_time, radiation_list)[0]
|
||||
self.position_delta = self._find_position_match(photo_time, position_list)[0]
|
||||
self.position_latitude = self._find_position_match(photo_time, position_list)[1][1]
|
||||
self.position_longitude = self._find_position_match(photo_time, position_list)[1][2]
|
||||
self.position_altitude = self._find_position_match(photo_time, position_list)[1][3]
|
||||
|
||||
def __repr__(self):
|
||||
if self.radiation[1]:
|
||||
radiation = round(self.radiation[1], 2)
|
||||
if self.radiation_value:
|
||||
radiation = round(self.radiation_value, 2)
|
||||
else:
|
||||
radiation = None
|
||||
|
||||
if self.position[1][3]:
|
||||
altitude = round(self.position[1][3])
|
||||
if self.position_altitude:
|
||||
altitude = round(self.position_altitude)
|
||||
else:
|
||||
altitude = None
|
||||
return 'Radiation: %s µS/h (Δt %s) \nPosition: Lat: %s, Long: %s, Alt: %sm (Δt %s)' % \
|
||||
(str(radiation), str(self.radiation[0]), str(self.position[1][1]), \
|
||||
str(self.position[1][2]), altitude, str(self.position[0]))
|
||||
(str(radiation), str(self.radiation_delta), str(self.position_latitude), \
|
||||
str(self.position_longitude), altitude, str(self.position_delta))
|
||||
|
||||
def _find_radiation_match(self, photo_time, list):
|
||||
valuelist = []
|
||||
|
@ -96,10 +96,10 @@ for src_photo in args.photos:
|
||||
match = Match(photo.get_date, radiation_list, position_list)
|
||||
|
||||
# Formatted output:
|
||||
data = Output(match.radiation[1], match.position[1][1], match.position[1][2], match.position[1][3])
|
||||
print('{:<15} {:<25} {:<22}'.format(photo.get_target_photo[0], str(photo.get_date), str(data)))
|
||||
data = Output(match.radiation_value, match.position_latitude, match.position_longitude, match.position_altitude)
|
||||
print('{:<15} {:<25} {:<22}'.format(photo.get_photo_basename, str(photo.get_date), str(data)))
|
||||
#print(match)
|
||||
|
||||
# Write exif data
|
||||
Exif(photo.get_target_photo[1], args.dry, match.radiation[1],
|
||||
match.position[1][1], match.position[1][2], match.position[1][3])
|
||||
Exif(photo.get_photo_filename, args.dry, match.radiation_value,
|
||||
match.position_latitude, match.position_longitude, match.position_altitude)
|
||||
|
Loading…
Reference in New Issue
Block a user