This commit is contained in:
Jeffrey Paul 2022-12-10 02:36:52 +01:00
parent f032025956
commit daa014c4e8
2 changed files with 67 additions and 0 deletions

22
import-video/import.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
DEST="/Volumes/video"
D="root@las1"
function main() {
if [[ ! -d "$DEST/2022" ]]; then
echo "wrong box" > /dev/stderr
exit 1
fi
SRC="$1"
cd "$SRC"
for FILE in * ; do
YYYY="$(echo "$FILE" | colrm 5)"
MM="$(echo "$FILE" | colrm 1 4 | colrm 3)"
DD="$(echo "$FILE" | colrm 1 6 | colrm 3)"
echo "ssh $D -- mkdir -p /storage/video/$YYYY/$YYYY-$MM/$YYYY-$MM-$DD"
echo "rsync -acvvvP \"$SRC/$FILE\" $D:/storage/video/$YYYY/$YYYY-$MM/$YYYY-$MM-$DD/"
done
}
main $*

45
photoimport/photoimport Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env zsh
set -x
set -e
set -o nullglob
YYYYMMDD="$(date "+%Y-%m-%d")"
function downloadPhotos() {
SRC=(/Volumes/*/DCIM)
if [[ ! -d "$SRC" ]]; then
echo "no photos" > /dev/stderr
return
fi
DST="$HOME/Library/Syncthing/folders/LightroomMasters-CurrentYear/toimport"
du -sh "$SRC"
rsync -ah --no-inc-recursive --info=progress2 --remove-source-files "$SRC"/ $DST/$YYYYMMDD/
cd "$DST/$YYYYMMDD"
mv */* .
f2 -r '../{{mtime.YYYY}}/{{mtime.YYYY}}-{{mtime.MM}}/{{mtime.YYYY}}-{{mtime.MM}}-{{mtime.DD}}/{{mtime.YYYY}}-{{mtime.MM}}-{{mtime.DD}}.{{x.model}}.{{f}}.{{hash.sha256}}{{ext}}' -x --verbose
}
function downloadVideos() {
SRC=(/Volumes/*/PRIVATE/M4ROOT/CLIP)
if [[ ! -d "$SRC" ]]; then
echo "no videos" > /dev/stderr
return
fi
DST="$HOME/_TODO/$YYYYMMDD-video-import/"
mkdir -p "$DST"
du -sh "$SRC"
rsync -ah --no-inc-recursive --info=progress2 --remove-source-files "$SRC"/ $DST/
cd "$DST"
#mv */* .
f2 -r '{{mtime.YYYY}}/{{mtime.YYYY}}-{{mtime.MM}}/{{mtime.YYYY}}-{{mtime.MM}}-{{mtime.DD}}/{{mtime.YYYY}}-{{mtime.MM}}-{{mtime.DD}}.{{f}}.{{hash.sha256}}{{ext}}' -x --verbose
}
function main() {
# FIXME this doesn't work if there are no photos on the card but the
# DCIM dir exists
downloadPhotos
downloadVideos
}
main