Skip to content

Instantly share code, notes, and snippets.

@wescopeland
Last active July 6, 2024 16:33
Show Gist options
  • Save wescopeland/271ea9c17d2d05319313dfcfceada3b9 to your computer and use it in GitHub Desktop.
Save wescopeland/271ea9c17d2d05319313dfcfceada3b9 to your computer and use it in GitHub Desktop.
RetroAchievements NAS Sync Script
#!/bin/bash
# syncRA.sh
# DISCLAIMER:
# This script is for educational and personal use only. It is intended to be used
# exclusively for syncing legally-owned ROM files. The user is responsible for
# ensuring they have the legal right to possess and use any ROMs synced with this script.
# The author of this script does not condone or encourage copyright infringement or
# the illegal distribution of ROM files. Use this script at your own risk and in
# compliance with all applicable laws and regulations in your jurisdiction.
# Function: syncRA
# Description: Syncs RetroAchievements game collections for various systems using rclone.
#
# Usage: syncRA [system]
#
# Parameters:
# system (optional): The game system to sync. If not provided, syncs all systems.
# Special handling for NES, SNES, PSP, PSX, and PS2.
#
# Examples:
# syncRA "Nintendo DS"
# syncRA "PSX"
# syncRA "SNES"
#
# Notes:
# - Requires rclone to be installed and configured.
# - PSX and PS2 have additional language exclusions.
# - PS2 syncs both A-M and N-Z collections.
syncRA() {
local system=$1
local baseUrl="https://archive.org/download/retroachievements_collection_v5"
local destination="/volume1/RA_Collection"
local src
local dest
local extra_args=()
case "$system" in
"NES")
src="https://archive.org/download/retroachievements_collection_NES-Famicom"
;;
"SNES")
src="https://archive.org/download/retroachievements_collection_SNES-Super_Famicom"
;;
"PSP")
src="https://archive.org/download/retroachievements_collection_PlayStation_Portable"
;;
"PSX")
src="https://archive.org/download/retroachievements_collection_PlayStation"
extra_args=(
--exclude "*\(France\)*"
--exclude "*\(Italy\)*"
--exclude "*\(Spain\)*"
--exclude "*\(Netherlands\)*"
--exclude "*\(Finland\)*"
--exclude "*\(Denmark\)*"
--exclude "*\(Norway\)*"
--exclude "*\(Germany\)*"
--exclude "*\(Sweden\)*"
--exclude "*\(Portugal\)*"
--exclude '*\[T-!(Eng|English)\]*'
)
;;
"PS2")
src="https://archive.org/download/retroachievements_collection_PlayStation_2_A-M"
extra_args=(
--exclude "*\(France\)*"
--exclude "*\(Italy\)*"
--exclude "*\(Spain\)*"
--exclude "*\(Netherlands\)*"
--exclude "*\(Finland\)*"
--exclude "*\(Denmark\)*"
--exclude "*\(Norway\)*"
--exclude "*\(Germany\)*"
--exclude "*\(Sweden\)*"
--exclude "*\(Portugal\)*"
--exclude '*\[T-!(Eng|English)\]*'
)
;;
*)
src="$baseUrl/$system"
;;
esac
dest="$destination/$system"
# Main sync command
rclone sync -P --http-url "$src" :http: "$dest" \
--local-case-sensitive \
--exclude "**/*.zip/*" \
--retries 3 \
--timeout 60s \
--transfers 16 \
--checkers 32 \
--fast-list \
--bwlimit 8M \
--low-level-retries 10 \
"${extra_args[@]}"
# Additional sync for PS2 N-Z collection
if [[ "$system" == "PS2" ]]; then
local src_nz="https://archive.org/download/retroachievements_collection_PlayStation_2_N-Z"
rclone sync -P --http-url "$src_nz" :http: "$dest" \
--local-case-sensitive \
--exclude "**/*.zip/*" \
--retries 3 \
--timeout 60s \
--transfers 16 \
--checkers 32 \
--fast-list \
--bwlimit 8M \
--low-level-retries 10 \
"${extra_args[@]}"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment