This commit is contained in:
holzi1005 2025-01-07 16:33:13 +01:00
parent 0088efd369
commit a451fa8306

View file

@ -15,15 +15,18 @@ inotifywait -m "$WATCH_PATH" -e close_write |
file_size=$(stat -c%s "$file_path")
num_chunks=$(( (file_size + chunk_size - 1) / chunk_size ))
for (( i=0; i<num_chunks; i++ )); do
i=0
while [ $i -lt $num_chunks ]; do
offset=$(( i * chunk_size ))
dd if="$file_path" bs=$chunk_size skip=$i count=1 2>/dev/null | curl \
--location "$UPLOAD_URL" \
dd if="$file_path" bs=$chunk_size skip=$i count=1 2>/dev/null | \
curl --location "$UPLOAD_URL" \
--header "Authorization: Bearer $AUTH_TOKEN" \
--form "recording_id=${id}" \
--form "chunk_index=${i}" \
--form "total_chunks=${num_chunks}" \
--form "FILE=@-"
i=$(( i + 1 ))
done
fi
done