master
Jeffrey Paul 2 months ago
parent f032025956
commit daa014c4e8
  1. 22
      import-video/import.sh
  2. 45
      photoimport/photoimport

@ -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 $*

@ -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
Loading…
Cancel
Save