From 8024b1df13c793af2810afeb86f8467d85f6681b Mon Sep 17 00:00:00 2001 From: dwrz Date: Wed, 1 Feb 2023 20:11:39 +0000 Subject: [PATCH] Refactor scripts --- scripts/notify | 1 - scripts/sync | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/notify b/scripts/notify index 5229909..b058891 100755 --- 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 index 52b2613..5d9b258 100755 --- 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.