Created
June 18, 2014 14:20
-
-
Save TobiasWooldridge/54da2b95c9f6b33171c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Uni import * | |
import time | |
servers = CSEM.loadServers(["lofty"]) | |
def notify(title, subtitle, message): | |
sh.Command("terminal-notifier")("-title", title, "-subtitle", subtitle, "-message", message) | |
# Get all users on every server | |
activeUsers = {} | |
while True: | |
users = CSEM.getUsers(servers) | |
newActiveUsers = {} | |
for user in users.values(): | |
newActiveUsers[user.fan] = user | |
for fan, user in newActiveUsers.iteritems(): | |
if not activeUsers.has_key(fan): | |
notify("CSEM", "+" + user.name, "%s logged in to lofty" % fan) | |
for fan, user in activeUsers.iteritems(): | |
if not newActiveUsers.has_key(fan): | |
notify("CSEM", "-" + user.name, "%s logged out of lofty" % fan) | |
activeUsers = newActiveUsers | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment