Guide: GOG game file archiving HowTo

GOG Archiving HowTo

Long ago there weren’t any good options for automatically archiving the many files that can be had from GOG. Eddie3 changed that when he released gogrepo on github. Eventually he stopped updating, and Kalanyr picked up the torch with the fork gogrepoc.

This is a tutorial on how to set up gogrepoc under linux. Being python based, everything here can likely be adapted to windows with a minimum of modification (.sh->.bat, change paths, and install tee for windows).
In your intended games archive location, I recommend having a GOG folder, which will store the downloaded games and associated files, and a GOG_scripts folder that stores the scripts you’ll set up to run things repeatedly.

Make sure you have python and pip installed. The following are dependencies needed to run gogrepoc. If you find any I missed let me know.

pip install html5lib html2text pyOpenSSL requests

Into your GOG_scripts folder download gogrepoc.py and the readme.md from either the master or dev branch. This command can also be used to update the file. I recommend saving the previous by adding a .bak though.

wget https://raw.githubusercontent.com/Kalanyr/gogrepoc/master/gogrepoc.py -O gogrepoc.py
wget https://github.com/Kalanyr/gogrepoc/blob/master/README.md

Getting a token

Delete any gog-token.dat files and login via command line.
My password required being enclosed in ‘’ as some of the characters resulted in weird replacements in bash going on.

python3 ./gogrepoc.py login [email protected] 'password123'

It’s possible a cookie from a browser might be needed, I haven’t really tested the latest changes.
If so use this addon: cookies.txt – Get this Extension for 🦊 Firefox (en-US)
Navigate to GOG and export cookie from current site as cookies.txt into the folder where gogrepoc.py is located.
50a9b72f0c944de8925e69ce8ddc45e7

Scripts

Now, inside out GOG_scripts folder we are going to create a few scripts filled with the commands we typically intend to run.

Create the following series of scripts. Remove the # if you want log files to be created with tee.
command_gog_update_full.sh

python3 gogrepoc.py update -os windows linux -full #|& tee log_Command_GOG_Update.txt

command_gog_update.sh
Note that the current (2022-11-06) update script may report various XML related errors. This shouldn’t actually hurt anything and you can just let the script continue to run.

python3 gogrepoc.py update -os windows linux -updateonly #|& tee log_Command_GOG_Update.txt

command_gog_download.sh

# Make sure the download folder path is correct if you have made changes or are mounting a network share.
python3 gogrepoc.py download /media/kpool/storage/Games/GOG/ -skipgalaxy -os windows linux -lang en #|& tee log_Command_GOG_Download.txt

command_gog_verify.sh

# Make sure the download folder path is correct if you have made changes or are mounting a network share.
python3 gogrepoc.py verify -skipgalaxy -clean /media/kpool/storage/Games/GOG/ #|& tee log_Command_GOG_Verify.txt

Basically run the scripts like this:
On the first run, or every several months run ./command_gog_update_full.sh to fully search through all available files, and generates a manifest file to store the information. This can be very time consuming if you have a large library.

After the first run, you can use ./command_gog_update.sh to quickly search for what has changed since the last run, using the gogrepoc generated manifest file as a reference. This will rarely miss some thing, so a full update is good every once in a while.

To start downloading any missing or changed files, run ./command_gog_download.sh. Make sure the download folder is correct. After it has finished, it’s worthwhile to run it a second time to pick up any files that timed out. Inside your GOG folder, a “!downloading” temp folder will be created to hold the files in progress. I have the command set to ONLY download english versions of the game. You may want to pull specific languages, or all languages (remove the “-lang” command line argument).

Finally, run ./command_gog_verify.sh to check the hashes of all files for corruption and to make sure you have what the manifest thinks you have. Inside your GOG folder, an “!orphaned” folder will be created when the “-clean” command line option is used. This is where files that are no longer have matching hashes in the manifest are moved, either because they are corrupt, older obsolete versions that were removed/renamed/reorganized, or more rarely, made to completely disappear because they were pulled by gog or the publisher for various reasons.

Misc Notes

For reference, there is an ongoing thread on GOG that Kalanyr lurks with problems being brought to his attention. There’s often some weird issue going on, generally because GOG likes to break their system in interesting ways, mostly on accident.

An alternative archiver has also appeared: GitHub - Sude-/lgogdownloader: LGOGDownloader is unofficial downloader to GOG.com for Linux users. It uses the same API as the official GOG Galaxy.
I have never tried it so I couldn’t tell you the differences.

5 Likes