Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
download_result = download.download_media(
icloud, photo, download_path, download_size
)
if download_result and set_exif_datetime:
if photo.filename.lower().endswith((".jpg", ".jpeg")):
if not exif_datetime.get_photo_exif(download_path):
# %Y:%m:%d looks wrong but it's the correct format
date_str = created_date.strftime(
"%Y:%m:%d %H:%M:%S")
logger.debug(
"Setting EXIF timestamp for %s: %s",
download_path,
date_str,
)
exif_datetime.set_photo_exif(
download_path,
created_date.strftime("%Y:%m:%d %H:%M:%S"),
)
else:
timestamp = time.mktime(created_date.timetuple())
os.utime(download_path, (timestamp, timestamp))
# Also download the live photo if present
if not skip_live_photos:
lp_size = live_photo_size + "Video"
if lp_size in photo.versions:
version = photo.versions[lp_size]
filename = version["filename"]
if live_photo_size != "original":
# Add size to filename if not original
filename = filename.replace(