From 0ada1aa767e7bcbb5e98d25e078bec93135847e4 Mon Sep 17 00:00:00 2001 From: Alex Hyett Date: Fri, 13 Sep 2024 14:41:31 +0100 Subject: [PATCH] Add icloud script --- README.md | 9 +++++---- icloud_download.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100755 icloud_download.sh diff --git a/README.md b/README.md index 292868a..6afc22d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ A collection of useful scripts that I use everyday. - `copyfiles.sh` - Same as the above but it copies instead of moves the files. [Notes](https://www.alexhyett.com/notes/moving-files-with-rsync/) - `slackit.sh` - I use this to easily send slack notifications to myself from inside other scripts. [Notes](https://www.alexhyett.com/notes/send-slack-messages-with-a-command/) - `sort_photos.py` - This file moves photos in my camera uploads folder into my main photos folder based on the date the photo was taken. [Notes](https://www.alexhyett.com/notes/sorting-photos-into-folders/) -- `down.sh` - Runs `docker-compose down` on in all the nested folders under `directory` [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) -- `up.sh` - Runs `docker-compose up -d` on in all the nested folders under `directory` [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) -- `stop.sh` - Runs `docker-compose stop` on in all the nested folders under `directory` [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) -- `start.sh` - Runs `docker-compose start` on in all the nested folders under `directory` [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) \ No newline at end of file +- `down.sh` - Runs `docker-compose down` on in all the nested folders under `directory`. [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) +- `up.sh` - Runs `docker-compose up -d` on in all the nested folders under `directory`. [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) +- `stop.sh` - Runs `docker-compose stop` on in all the nested folders under `directory`. [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) +- `start.sh` - Runs `docker-compose start` on in all the nested folders under `directory`. [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) +- `icloud_download.sh` - I use this to download my iCloud photos. [Notes](https://www.alexhyett.com/notes/download-photos-from-icloud/) \ No newline at end of file diff --git a/icloud_download.sh b/icloud_download.sh new file mode 100755 index 0000000..31f94c1 --- /dev/null +++ b/icloud_download.sh @@ -0,0 +1,32 @@ +#!/bin/bash +parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$parent_path" + +# Import variables +set -a +source .env +set +a + +VERSION=1.23.0 +FILE=icloudpd-$VERSION-linux-amd64 + +if [ ! -f $FILE ]; then + echo "icloudpd missing, downloading" + wget https://github.com/icloud-photos-downloader/icloud_photos_downloader/releases/download/v$VERSION/icloudpd-$VERSION-linux-amd64 + chmod +x $FILE +fi + +echo "Syncing iCloud Photos" + +./$FILE --directory $PHOTO_FOLDER \ + --username "$APPLE_EMAIL" \ + --password "$APPLE_PASSWORD" \ + --library "$APPLE_LIBRARY" \ + --recent 500 \ + --until-found 10 \ + --set-exif-datetime \ + --folder-structure none \ + --file-match-policy name-size-dedup-with-suffix \ + --skip-live-photos + +echo "Completed Syncing iCloud Photos" \ No newline at end of file