Skip to content

Instantly share code, notes, and snippets.

@rsky
Created March 8, 2015 08:48
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 rsky/ba22070c1d8a3785dbbe to your computer and use it in GitHub Desktop.
Save rsky/ba22070c1d8a3785dbbe to your computer and use it in GitHub Desktop.
import subprocess
from logbook.data import DataType
def osx_notify(message):
subprocess.call(('/opt/local/bin/terminal-notifier', '-message', message))
desktop_notify = osx_notify
def update(type, data):
if type in (DataType.START, DataType.NEXT):
api_data = data.getJsonObject().getJsonObject("api_data")
enemy = api_data.getJsonObject("api_enemy") if api_data else None
if enemy:
enemy_id = enemy.getInt("api_enemy_id")
desktop_notify("api_enemy_id={0}".format(enemy_id))
else:
# desktop_notify(str(type))
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment