## Introduction ##
Since Beeminder does not integrate with Memrise, this simple script aims to provide a way of automatically minding your cumulative score. This script can be called by cron or manually every time after doing some learning. It is designed to work with the odometer (or “biker”) goal types, where the datapoints are cummulative, that means the total points scored from the very beginning until now.
Along with Memrise, there is also a support for Duolingo. Although Beeminder has its own native support for Duolingo, it is able to track only one language at once. That is a different approach than Duolingo itself uses with its Coach. The Coach tracks the daily points for all languages together. This script can be used to push the cumulative total score from all your Duolingo language courses.
Before the first run call:
bundle installThe minding itself is done by running a Rake task memrise or duolingo. It reads your credentials from the environment. Example:
$ MEMRISE_USERNAME=AwesomePolyglot MEMRISE_PASSWORD=sup3rs3cr3t BEEMINDER_USERNAME=lazybones BEEMINDER_AUTH_TOKEN=d34df4c3bbqblah BEEMINDER_MEMRISE_GOAL=memrise rake memriseor
$ DUOLINGO_USERNAME=AwesomePolyglot BEEMINDER_USERNAME=lazybones BEEMINDER_AUTH_TOKEN=d34df4c3bbqblah BEEMINDER_MEMRISE_GOAL=duolingo rake duolingoHere is a list of environment variables used by this script:
BEEMINDER_USERNAMEBEEMINDER_AUTH_TOKENBEEMINDER_MEMRISE_GOALBEEMINDER_DUOLINGO_GOAL
Both USERNAME and AUTH_TOKEN can be found on this JSON URL, if you are signed in: https://www.beeminder.com/api/v1/auth_token.json. The USERNAME is also the last part of the URL of the Your Goals page. E.g.: https://www.beeminder.com/ lazybones.
The GOAL variables take the last part of the URL of your Goal page. It is the value you filled in the “Your goal’s URL” upon creating the goal. E.g.: https://www.beeminder.com/lazybones/goals/ memrise.
MEMRISE_USERNAMEMEMRISE_PASSWORDBEEMINDER_MEMRISE_GOAL
Because Memrise does not provide an API, Mechanize gem is used to fetch the number of points. It simulates a browser: it logs in on your behalf and loads the dashboard page, where the total number of points is stated. Neither the password, nor any cookies are stored. Every time the script is run, it makes a fresh log-in.
If something changes at Memrise, be it the login process or the Dashboard, this script might stop working.
DUOLINGO_USERNAMEBEEMINDER_DUOLINGO_GOAL
Since Duolingo user profiles are publicly accessible, a username is enough to find all the data needed. There is no need to provide a password. Luckily enough, the use profile is readable in the JSON format that means that it is less probable that this script will break because of changes in the Duolingo markup.