The various bits and pieces that make up my *gdq tracker. This is a cobbled together bunch of scripts and other bits and pieces and I don't intend anyone except me to run it.
Copy config.example.sh to config.sh and fill in the everything, except the twitch variables, which are covered next.
Get twitch client id and secret from https://dev.twitch.tv/console/apps, put them in config.sh.
Run twitch-utils/get-access-token.sh
, this will use the client id and secret
to get an access token. Copy it into config.sh.
Run twitch-utils/test-access-token.sh
, passing in the username of a live
twitch streamer. This will call a couple of endpoints and should print some
info about the stream. If it doesn't the token probably doesn't work.
This is run by cron every minute. It fetches the viewer count from the twitch API, the donation total from the tracker API and scrapes the schedule from the schedule page.
This script isn't pretty but it's been proven to not die very often over the years. It attempts to recover from any errors and write a null in place of the data it would have written, to ensure there's a record in the JSON for every minute no matter what.
The cron job looks something like this:
* * * * * cd /home/alligator/dev/agdq-tracker/sgdq19 && /home/alligator/.local/bin/pipenv run python get-data.py
This is the code for the actual tracker you see. As before the code is real ugly (and ancient in terms of JS coding standards) but it continues to work with only minor tweaks, so it's here to stay I guess.
misc/comparison
contains the code for the comparison chart.
This was hacked together quickly and it shows.
misc/comparison-new
contains the code for the newer comparison chart.
This is also hacked together, but is slightly more useable.
The newest comparison chart lives in it's own repository.
misc/original-tracker
contains the code for the original tracker
, which used the google charts API instead of d3.
misc/gdq-announce.py
a very simple python script that looks at the json
output from the tracker and posts a message to a discord webhook when a new
game is coming up. i point it at a gdq specific channel on a discord server so
people can always see what's on now and what's up next.