How to use the icloudpd.exif_datetime.get_photo_exif function in icloudpd

To help you get started, we’ve selected a few icloudpd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ndbroadbent / icloud_photos_downloader / icloudpd / base.py View on Github external
if only_print_filenames:
                    print(download_path)
                else:
                    truncated_path = truncate_middle(download_path, 96)
                    logger.set_tqdm_description(
                        "Downloading %s" %
                        truncated_path)

                    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))