Skip to content

Instantly share code, notes, and snippets.

@maluramichael
Created August 16, 2022 18:17
Show Gist options
  • Save maluramichael/31dc56cfc28bb65a2e8157319f6b5d39 to your computer and use it in GitHub Desktop.
Save maluramichael/31dc56cfc28bb65a2e8157319f6b5d39 to your computer and use it in GitHub Desktop.
Utilizes lgogdownloaded to download gog games. Supports skipping games by name.
#!/bin/bash
set -e
set -u
SKIP_GAMES="cyberpunk chernobylite"
if grep -qs '/tank' /proc/mounts; then
echo 'Download gog games to /tank/games/gog/'
lgogdownloader \
--update-cache \
--language=de,en \
--threads 24 \
--info-threads 24 \
--cache-valid 604800 \
--save-serials \
--automatic-xml-creation \
--save-changelogs \
CACHE_DIR="$HOME/.cache/lgogdownloader"
CACHE_DIR_GAMES="$CACHE_DIR/xml"
GAME_DETAILS="$CACHE_DIR/gamedetails.json"
for GAME in $SKIP_GAMES; do
GAME_DIR="$CACHE_DIR_GAMES/$GAME"
if [ -d "$GAME_DIR" ]; then
echo "DELETE CACHE $GAME_DIR"
rm -r "$GAME_DIR"
fi
TEMP_FILE=$(mktemp /tmp/gamelist.json.XXXXXX)
jq -r --arg GAMENAME "$GAME" '( .games |= map( select( .gamename | contains($GAMENAME) | not ) ) )' "$GAME_DETAILS" > "$TEMP_FILE"
mv "$TEMP_FILE" "$GAME_DETAILS"
done
cd /tank/games/gog
ls
lgogdownloader \
--download \
--use-cache \
--subdir-game %gamename%/%platform% \
--directory . \
--platform w \
--language de,en \
--save-serials \
--automatic-xml-creation \
--save-changelogs \
--threads 4 \
--info-threads 12
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment