Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Prints all bonus content changes tracked by GOG DB.
Needs a CSV dump in data/
import csv
"add": "+",
"del": "-",
"change": "~"
with open("data/changerecords.csv") as changerecords_file:
changerecords_reader = csv.DictReader(changerecords_file)
changerecords = list(changerecords_reader)
changerecords.sort(key=lambda x: int(x["id"]))
downloads = {}
with open("data/downloads.csv") as downloads_file:
downloads_reader = csv.DictReader(downloads_file)
for download in downloads_reader:
dlkey = (download["prod_id"], download["slug"])
downloads[dlkey] = download
products = {}
with open("data/products.csv") as products_file:
products_reader = csv.DictReader(products_file)
for product in products_reader:
products[product["id"]] = product
for changerecord in changerecords:
if changerecord["type_prim"] == "download":
product = products[changerecord["prod_id"]]
download = downloads[(changerecord["prod_id"], changerecord["resource"])]
if download["type"] == "bonus_content":
symbol = CHANGE_SYMBOL[changerecord["action"]]
changerecord["timestamp"].split()[0], # Date part only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.