-
Notifications
You must be signed in to change notification settings - Fork 4
/
process_and_upload.sh
executable file
·36 lines (30 loc) · 1.29 KB
/
process_and_upload.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
read -p "Enter API key: " KEY
read -p "Enter server address (https://sld.tld/api): " SERVER
read -p "Enter your base dir (where the takeout zips are): " BASE_DIR
read -p "Enter the docker dir (make sure not to use a network mount path - can be the same as base dir): " DOCKER_DIR
ALBUM_DIR="${BASE_DIR}/Takeout/Google Photos/AlbumsProcessed"
PHOTO_DIR="${BASE_DIR}/Takeout/Google Photos/PhotosProcessed"
# Change the working directory to BASE_DIR
cd "$BASE_DIR"
# First unzip takeout files
unzip "*.zip"
# Now run exif fixing docker
cd "$DOCKER_DIR"
## The reason for having a dedicated docker dir is because docker can only run on
## a full linux FS. In my setup I have the remote dirs on a cifs mount so docker
## won't run there
git clone --recurse-submodules https://github.com/lukehmcc/exif-wrapper.git
cd exif-wrapper
echo "TAKEOUT_DIR=${BASE_DIR}/Takeout" > .env
docker compose up --build
# Upload photos
docker run -it --rm -v "$PHOTO_DIR:/import" ghcr.io/immich-app/immich-cli:latest upload -y -k "$KEY" -s "$SERVER" -t 16
# Upload albums
cd "$ALBUM_DIR"
for album in *; do
if [ -d "$album" ]; then
echo "Uploading album: $album"
docker run -it --rm -v "$(pwd)/$album:/import/$album" ghcr.io/immich-app/immich-cli:latest upload -y -k "$KEY" -s "$SERVER" -t 16 -al "$album"
fi
done