]> Git — Sourcephile - julm/camera.git/blob - julm/pull.sh
pull: make it per user
[julm/camera.git] / julm / pull.sh
1 #!/usr/bin/env bash
2 host=Xiaomi_SDM439-QRD__SN%3AB0796589_c7565cf60006
3 cd "${0%/*}"
4 set -eux
5 gio mount -l | grep mtp://"$host" ||
6 gio mount mtp://"$host"/"Carte SD SanDisk"/
7
8 year=$(date +%Y)
9
10 mkdir -p "$year"/audio/src
11 rsync -ai --no-inc-recursive --info=progress2 --inplace --partial \
12 --remove-source-files \
13 /run/user/"$(id -u)"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé"/MIUI/sound_recorder \
14 "$year"/audio/src/
15
16 # FIXME: handle previous year on new year
17 mkdir -p "$year"/src
18 for month in {01..12}; do
19 rsync -ai --no-inc-recursive --info=progress2 --inplace --partial \
20 --remove-source-files \
21 --include "???_$year$month*" \
22 --exclude '*' \
23 /run/user/"$(id -u)"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé"/DCIM/Camera/ \
24 /run/user/"$(id -u)"/gvfs/mtp:host="$host"/"Carte SD SanDisk"/DCIM/Camera/ \
25 "$year"/src/"$month"
26 done