Fixed Photo return value for overwriting source files.
This commit is contained in:
parent
5a39f08f35
commit
3987d484ad
13
functions.py
13
functions.py
|
@ -53,8 +53,9 @@ class Photo:
|
||||||
dry_run: whether to acutally write (True / False)
|
dry_run: whether to acutally write (True / False)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
self.get_date: timestamp of photo als datetime object
|
get_date: timestamp of photo als datetime object
|
||||||
self.get_target_photo: full path to photo file to work on
|
get_photo_filename: full path to photo file to work on
|
||||||
|
get_photo_basename: only filename (e. g. for print output)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, photo, local_timezone, dest_dir, dry_run):
|
def __init__(self, photo, local_timezone, dest_dir, dry_run):
|
||||||
|
@ -67,9 +68,10 @@ class Photo:
|
||||||
|
|
||||||
def _copy_photo(self, photo, dest_dir, dry_run):
|
def _copy_photo(self, photo, dest_dir, dry_run):
|
||||||
# Determine where to work on photo and copy it there if needed.
|
# Determine where to work on photo and copy it there if needed.
|
||||||
|
|
||||||
# Get image file name out of path
|
# Get image file name out of path
|
||||||
photo_basename = os.path.basename(photo)
|
photo_basename = os.path.basename(photo)
|
||||||
# be os aware and use the correct directory delimiter for destfile
|
# be os aware and use the correct directory delimiter for dest_photo
|
||||||
dest_photo = os.path.join(dest_dir, photo_basename)
|
dest_photo = os.path.join(dest_dir, photo_basename)
|
||||||
|
|
||||||
# Copy photo to dest_dir and return its (new) filename
|
# Copy photo to dest_dir and return its (new) filename
|
||||||
|
@ -78,7 +80,8 @@ class Photo:
|
||||||
return photo_basename, photo
|
return photo_basename, photo
|
||||||
if dest_dir != '.':
|
if dest_dir != '.':
|
||||||
shutil.copy(photo, dest_photo)
|
shutil.copy(photo, dest_photo)
|
||||||
return photo_basename, dest_photo
|
return photo_basename, dest_photo
|
||||||
|
return photo_basename, photo
|
||||||
|
|
||||||
def _get_creation_date(self, photo, local_timezone):
|
def _get_creation_date(self, photo, local_timezone):
|
||||||
# Load Exif data from photo
|
# Load Exif data from photo
|
||||||
|
@ -103,7 +106,7 @@ class Match:
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
minimal timedelta: as timedelta object
|
minimal timedelta: as timedelta object
|
||||||
best matching valuerow
|
best matching values
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, photo_time, radiation_list, position_list):
|
def __init__(self, photo_time, radiation_list, position_list):
|
||||||
|
|
Loading…
Reference in New Issue