At this point this is a really basic project - it reads in a list of boardgamegeek users and writes the games they own out to a spreadsheet on Google. I threw it together in a couple hours on a whim, to be able to easily be able to see what games other gamers in a group own. It prints out to a google sheet all the games owned by people in your group (listed by ranking on BGG) as well as a list of people that own that game
I am open to contributions, even ones that drastically change the structure of the project, as long as they only add functionality, and don't remove any.
- Clone the repository.
- Create a file named usernames.csv in the directory where you will be running the script, I do it in the root folder of the repo (formatted "Person,username")
- Create a project through the Google API Console and get credentials to hit the google sheets api, as explained here. Put the credentials file (name it client-secret.json) in the directory where you will be running the script.
- Create a spreadsheet named "Games" in Google Drive and share it to the email associated with the credentials created in step 3.
- Using launchd, cron, or some other utility, set up the script to run at some specified interval. A sample launchd configuration file is given below.
- Share the spreadsheet created in step 4 with your group.
Note that this only works on mac, but apple recommends you use it over cron on mac
- Go to ~/Library/LaunchAgents
- Create a file called local.bgg.plist, that contains the following: (more info about plist files here)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.bgg</string>
<key>Program</key>
<string>/path/to/repo/run.sh</string>
<key>WorkingDirectory</key>
<string>/path/to/working/directory</string>
<key>EnvironmentVariables</key>
<!-- make git, grep, sed accessible -->
<dict>
<key>PATH</key>
<string>/bin:/usr/bin:/usr/local/bin</string>
</dict>
<!-- run every morning at 6 (or when the computer wakes up if it's sleeping at 6 -->
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>6</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<!-- also run whenever the usernames file is updated -->
<key>WatchPaths</key>
<array>
<string>/path/to/usernames.csv</string>
</array>
<key>StandardOutPath</key>
<string>/tmp/bgg.stdout</string>
<key>StandardErrorPath</key>
<string>/tmp/bgg.stdout</string>
</dict>
</plist>
- Run
launchctl load ~/Library/LaunchAgents/local.bgg.plist