Files
2026-05-23 11:43:12 +02:00

24 lines
454 B
Bash

#!/usr/bin/env bash
source ~/cycling/app/.config
ACCESS_TOKEN=$(~/cycling/app/login.sh)
inotifywait -m ~/cycling/inbox -e create |
while read path action file; do
FULLFILE="$path$file"
echo "Uploading: $FULLFILE"
RESPONSE=$(./upload.sh "$ACCESS_TOKEN" "$FULLFILE")
if echo "$RESPONSE" | jq -e '.id' >/dev/null; then
echo "OK"
mv "$FULLFILE" ~/cycling/uploaded/
else
echo "FAIL"
mv "$FULLFILE" ~/cycling/failed/
fi
done