Skip to content

Instantly share code, notes, and snippets.

@markwk
Created December 7, 2017 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markwk/7c8e3debba11f250c18f3e9b99e4fd4a to your computer and use it in GitHub Desktop.
Save markwk/7c8e3debba11f250c18f3e9b99e4fd4a to your computer and use it in GitHub Desktop.
Scripts for Stats from WordCounter App for Mac
# Python Script for Word Counter for Mac
# Collects Daily Score
import plistlib
import os
import time
def add(x, y): return x + y
today = time.strftime("%Y-%m-%d")
# read PLIST
records = os.path.expanduser('~/Library/Application Support/WordCounter/app_records.plist')
data = plistlib.readPlist(records)
# collect per-app totals
apps = data[today]
counts = []
for app in apps:
count = reduce(add, app["counts"])
counts.append(count)
print app["id"] + ": " + str(count)
total = reduce(add, counts)
print total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment