]> Git — Sourcephile - julm/camera.git/blob - sevy/pull.sh
sevy/pull: update to use julm/pull's logic
[julm/camera.git] / sevy / pull.sh
1 #!/usr/bin/env bash
2 host=Xiaomi_SDM439-QRD__SN%3AE77E9453_c645cda90006
3 cd "${0%/*}"
4 set -eux
5
6 uid=$(id -u)
7 year=${year:-$(date +%Y)}
8 # FIXME: handle previous year on new year
9
10 gio mount -l | grep file:///run/media/"$USER"/3634-6462 ||
11 gio mount file:///run/media/"$USER"/3634-6462 || true
12
13 mkdir -p "$year"/src
14 for month in {01..12}; do
15 for src in \
16 /run/media/"$USER"/3634-6462/DCIM/ \
17 /run/user/"$uid"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé"/DCIM/Camera/ \
18 /run/user/"$uid"/gvfs/mtp:host="$host"/"Carte SD"/DCIM/Camera/
19 do
20 test ! -e "$src" ||
21 find "$src" -type f -name "???_$year$month*" -print0 |
22 rsync -ai0 --no-inc-recursive --info=progress2 --inplace --partial \
23 --size-only \
24 --files-from - --no-relative \
25 / "$year"/src/"$month"
26 done
27 done