24 lines
438 B
Bash
24 lines
438 B
Bash
#!/usr/bin/env bash
|
|
|
|
source ~/cycling/.config
|
|
|
|
ACCESS_TOKEN=$(./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 |