#!/bin/bash
export AWS_ACCESS_KEY_ID=93a1ff896096643b6662c7415f90b0aa
export AWS_SECRET_ACCESS_KEY=15eee774957d434e27a7f5590c5951674fc5af153c0a8fdaa5d234c3ce8dda71
ENDPOINT=https://cb908ed13329eb7b186e06ab51bda190.r2.cloudflarestorage.com

echo "Uploading wavs + txts to R2 with 20 parallel threads..."

# Upload wavs (already have segments dir structure)
aws s3 sync /home/ubuntu/modi_processed/segments/ s3://voices/modi_processed/ \
    --endpoint-url "$ENDPOINT" --region auto \
    --only-show-errors &

# Upload txts
aws s3 sync /tmp/modi_txt/ s3://voices/modi_processed/ \
    --endpoint-url "$ENDPOINT" --region auto \
    --only-show-errors &

wait
echo "R2 UPLOAD DONE" 
