commit 8024b1df13c793af2810afeb86f8467d85f6681b
parent b895528fbaa3defd60b0690f446fa0af2c1532cf
Author: dwrz <dwrz@dwrz.net>
Date: Wed, 1 Feb 2023 20:11:39 +0000
Refactor scripts
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/scripts/notify b/scripts/notify
@@ -78,7 +78,6 @@ delete_outdated() {
rm -f "$1"
rm -f "${PROJECT}/motion/${name}.jpg"
find "${HOME}/photo/" -mmin +5 -delete
- find "${HOME}/timelapse/" -mmin +60 -delete
find "${PROJECT}/motion/" -iname "*.jpg" -mmin +5 -delete
find "${PROJECT}/motion/labels/" -mmin +5 -delete
diff --git a/scripts/sync b/scripts/sync
@@ -3,11 +3,15 @@
readonly BUCKET="${B2_BUCKET}"
main() {
+ local filepath="$1"
+ local name
+ name="$(basename "${filepath}")"
+
backblaze-b2 upload-file \
--threads 2 \
"${BUCKET}" \
- "${PROJECT}/motion/${name}.jpg" \
- "${HOSTNAME}/timelapse/$1"
+ "${HOME}/timelapse/${name}" \
+ "${HOSTNAME}/timelapse/${name}"
# Delete outdated files.
# This assumes the timelapse is created on an hourly basis.