Last active
June 15, 2024 11:29
-
-
Save unknown321/0b56681ccab7b95b85068c345b2abaf7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -eo pipefail | |
| rcloneVersion="v1.53.3" | |
| rcloneUrl="https://downloads.rclone.org/${rcloneVersion}/rclone-${rcloneVersion}-linux-amd64.zip" | |
| url="https://raw.githubusercontent.com/vrpyou/quest/main/vrp-public.json" | |
| if ! test -f vrp-public.json; then | |
| curl -k -O "${url}" | |
| fi | |
| mkdir -p .bins | |
| if ! test -d ./.bins/rclone-${rcloneVersion}-linux-amd64 ; then | |
| curl -O "${rcloneUrl}" | |
| unzip -d .bins/ rclone-${rcloneVersion}-linux-amd64.zip | |
| rm rclone-${rcloneVersion}-linux-amd64.zip | |
| fi | |
| downloadDir="./downloads" | |
| baseURL=$(jq .baseUri vrp-public.json | tr -d '"') | |
| password=$(jq .password vrp-public.json | tr -d '"' | base64 -d) | |
| if ! test -d .meta; then | |
| # in case you need meta info | |
| ./.bins/rclone-${rcloneVersion}-linux-amd64/rclone --http-url ${baseURL} sync ":http:/meta.7z" . | |
| 7z x -p${password} meta.7z | |
| fi | |
| if test -z "$@"; then | |
| read -p "Enter app name: " appName | |
| else | |
| appName="$@" | |
| fi | |
| readarray -t -s 0 apps < <(awk -F ';' '{print $2}' VRP-GameList.txt | grep -i "${appName}" | sort ) | |
| echo "${apps[@]}" | |
| if test "${#apps[@]}" -eq 0; then | |
| echo "${appName} not found" | |
| exit 0 | |
| fi | |
| if test "${#apps[@]}" -eq 1; then | |
| appFullName="${apps[0]}" | |
| fi | |
| if test "${#apps[@]}" -gt 1; then | |
| for i in "${!apps[@]}"; do | |
| let ti=${i}+1 | |
| echo "${ti}: ${apps[$i]}" | |
| done | |
| read -p "Enter app number (1-${#apps[@]}): " appNumber | |
| let appNumber=appNumber-1 || true | |
| appFullName="${apps[${appNumber}]}" | |
| fi | |
| echo "Downloading ${appFullName}..." | |
| nameHash=$(echo "${appFullName}" | md5sum | cut -d ' ' -f 1) | |
| ./.bins/rclone-${rcloneVersion}-linux-amd64/rclone --progress --http-url ${baseURL} sync ":http:/${nameHash}/" "${downloadDir}/${appFullName}" | |
| 7z x -p${password} "${downloadDir}/${appFullName}/${nameHash}.7z.001" -o"${downloadDir}/${appFullName}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment