After a disgraceful number of timeouts, and no mobile app on the horizon, I sat down this afternoon to code a simple python notifier that would tell me the number of active games I had on OGS. (I’d offer it to the world, but it’s implemented as a status plugin to py3bar under the i3 window manager, and I don’t think that it’s sufficiently useful to other people to justify supporting it.)
It took me about an hour of digging, altogether, to get something functional. I currently have a nice ‘OGS: 4’ line in my status bar that will pop up Chromium when I click on it. (I still have to log in manually every time, but that’s another issue…)
What I’d like now is for my notifier to turn a frightening shade of red if any game drops below a given minimum time left to play, as I still don’t receive email warnings of this. From looking at the API, though, I’m confused as to how to calculate the time remaining for the current active player in a given game.
The relevant fields in the ‘games’ section of the API seem to be: “last_move”, “expiration”, and “thinking_time” (which can be negative). I could probably work it out, but I found another thread here that implied it was confusing.
As a simple question, then, how do I calculate the time remaining for the current play to make a move using the available fields in the API? (This is aimed at correspondence games, so no need to worry about the specifics of live games.)
(All I’m really looking for is something like: “It’s (expiration - now).”)