This commit is contained in:
NotSoToothless
2026-06-17 00:32:30 -07:00
committed by GitHub
parent d07afdee21
commit 7bd8a1b72c
10 changed files with 808 additions and 32 deletions
+22 -4
View File
@@ -1,18 +1,36 @@
#!/usr/bin/env bash
# Pull TSS replay dirs from the server for local study.
# Run once manually: bash fetch_replays.sh
# Pull the latest TSS replay dirs from the server for local study.
# Run once manually: bash fetch_replays.sh [COUNT] (default COUNT=10)
set -euo pipefail
REMOTE="srebot"
REMOTE_PATH="/mnt/HC_Volume_105581488/STORAGE/REPLAYS/TSS/"
LOCAL_PATH="./replays_sample"
COUNT="${1:-10}"
mkdir -p "$LOCAL_PATH"
# Grab the COUNT most-recently-modified replay dirs (newest first).
mapfile -t DIRS < <(ssh "$REMOTE" "cd '$REMOTE_PATH' && ls -1dt */ 2>/dev/null | head -n $COUNT")
if [ "${#DIRS[@]}" -eq 0 ]; then
echo "No replay dirs found on ${REMOTE}:${REMOTE_PATH}" >&2
exit 1
fi
echo "Pulling ${#DIRS[@]} latest replay dir(s):"
printf ' %s\n' "${DIRS[@]}"
# Build include filters: each dir + its replay_data.json.gz, exclude the rest.
INCLUDES=()
for d in "${DIRS[@]}"; do
d="${d%/}"
INCLUDES+=( --include="${d}/" --include="${d}/replay_data.json.gz" )
done
rsync -avz --progress \
--include="*/" \
--include="replay_data.json.gz" \
"${INCLUDES[@]}" \
--exclude="*" \
"${REMOTE}:${REMOTE_PATH}" \
"$LOCAL_PATH/"