diff --git a/import-video/import.sh b/import-video/import.sh new file mode 100755 index 0000000..bb11190 --- /dev/null +++ b/import-video/import.sh @@ -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 $* diff --git a/photoimport/photoimport b/photoimport/photoimport new file mode 100755 index 0000000..e2b99e5 --- /dev/null +++ b/photoimport/photoimport @@ -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