How to use the icloudpd.download 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
lp_download_path = os.path.join(download_dir, filename)

                    if only_print_filenames:
                        print(lp_download_path)
                    else:
                        if os.path.isfile(lp_download_path):
                            logger.set_tqdm_description(
                                "%s already exists."
                                % truncate_middle(lp_download_path, 96)
                            )
                            break

                        truncated_path = truncate_middle(lp_download_path, 96)
                        logger.set_tqdm_description(
                            "Downloading %s" % truncated_path)
                        download.download_media(
                            icloud, photo, lp_download_path, lp_size
                        )

            break

        if until_found is not None and consecutive_files_found >= until_found:
            logger.tqdm_write(
                "Found %d consecutive previously downloaded photos. Exiting"
                % until_found
            )
            if hasattr(photos_enumerator, "close"):
                photos_enumerator.close()
            break

    if only_print_filenames:
        exit(0)
github ndbroadbent / icloud_photos_downloader / icloudpd / base.py View on Github external
logger.set_tqdm_description(
                    "%s already exists." % truncate_middle(download_path, 96)
                )
            else:
                if until_found is not None:
                    consecutive_files_found = 0

                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,