Ok I’m giving Cold Turkey another shot. It might not have a scripting interface BUT obviously it gotta store its stuff somewhere. So I looked where mac apps usually store their stuff: At Library/Application Support
et voilà there’s two sqlite3 files.
A note to DB admins: You might wanna close your eyes for this because clearly the author of Cold Turkey decided to hell with normalization:
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "current" ("key" TEXT PRIMARY KEY NOT NULL, "value" TEXT NOT NULL);
INSERT INTO "current" VALUES('ignoreIncognito','false');
INSERT INTO "current" VALUES('blockList','facebook.com@twitter.com@netflix.com@collegehumor.com@imgur.com@youtube.com@vimeo.com@ebay.com@mashable.com@amazon.com@9gag.com@reddit.com@4chan.org@tumblr.com@pinterest.com@instagram.com@flickr.com@fmylife.com@deviantart.com@stumbleupon.com@myspace.com@tagged.com@pof.com@orkut.com@delicious.com@vk.com@theonion.com@theoatmeal.com@twitch.tv@espn.go.com@addictinggames.com@bored.com@break.com@bufferapp.com@boingboing.net@buzzfeed.com@buy.com@cheezburger.com@cracked.com@dailymotion.com@digg.com@ebaumsworld.com@feedly.com@funnyjunk.com@funnyordie.com@kickstarter.com@liveleak.com@miniclip.net@newgrounds.com@ok.ru@penny-arcade.com@runescape.com@xkcd.com@ytmnd.com');
INSERT INTO "current" VALUES('blockListApp','');
INSERT INTO "current" VALUES('exceptionList','');
INSERT INTO "current" VALUES('statsEnabled','false');
INSERT INTO "current" VALUES('statsEnabledIncognito','false');
INSERT INTO "current" VALUES('blockActive','true');
CREATE TABLE IF NOT EXISTS "settings" ("key" TEXT PRIMARY KEY NOT NULL, "value" TEXT NOT NULL);
INSERT INTO settings VALUES('settings','{"additional":{"win10":[]},"settings":{"sprintC":"","scheduleLimited":"true","limitE":"","frozenTurkey":"false","notifyDone":"true","limitD":"","weekStartMonday":"false","scheduleLocked":"","sprintB":",","password":"","notifyWarning":"true","statsEnabledIncognito":"false","statsEnabled":"false","show24hour":"false","timerLocked":"true","sprintA":",","notifyBreak":"true"},"lists":[{"apps":[],"web":["facebook.com","twitter.com","netflix.com","collegehumor.com","imgur.com","youtube.com","vimeo.com","ebay.com","mashable.com","amazon.com","9gag.com","reddit.com","4chan.org","tumblr.com","pinterest.com","instagram.com","flickr.com","fmylife.com","deviantart.com","stumbleupon.com","myspace.com","tagged.com","pof.com","orkut.com","delicious.com","vk.com","theonion.com","theoatmeal.com","twitch.tv","espn.go.com","addictinggames.com","bored.com","break.com","bufferapp.com","boingboing.net","buzzfeed.com","buy.com","cheezburger.com","cracked.com","dailymotion.com","digg.com","ebaumsworld.com","feedly.com","funnyjunk.com","funnyordie.com","kickstarter.com","liveleak.com","miniclip.net","newgrounds.com","ok.ru","penny-arcade.com","runescape.com","xkcd.com","ytmnd.com"],"listName":"Distractions","exceptions":[],"win10":[]}],"timers":[{"startTime":"2019,11,25,14,41","locked":"true","endTime":"2019,11,25,14,56","listName":"Distractions","enabled":"true","break":"none"}],"scheduler":[]}');
CREATE TABLE IF NOT EXISTS "stats" ("date" REAL NOT NULL, "file" TEXT NOT NULL, "seconds" REAL NOT NULL, PRIMARY KEY ("date", "file"));
COMMIT;
We’re looking at… JSON inside of a sqlite3 db. We’re also looking at a @
separated list of domains.
As we can see there’s a currently active timer:
"timers":[{"startTime":"2019,11,25,14,41","locked":"true","endTime":"2019,11,25,14,56","listName":"Distractions","enabled":"true","break":"none"}]
It’s not perfect but it’s something. All it needs is something that watches for changes in that file. An sqlite lib to read the file and some json lib to get the info out of there.
And if worst comes to worst there is also AppleScript / JavaScript.