Permalink
Browse files

Hu now records the name of the wireless network you're connected to (…

…so you can do some location-based queries (if you know where networks are)).
  • Loading branch information...
1 parent 6d427b8 commit 94d1552b4297bf4d9f793fae5a426b8f5502e305 @scottjacksonx committed May 25, 2010
Showing with 9 additions and 2 deletions.
  1. +9 −2 hu.py
View
11 hu.py
@@ -53,7 +53,11 @@ def getCurrentApp():
"""
return commands.getoutput("osascript scripts/frontApplication.applescript")
-
+def getCurrentNetworkName():
+ """
+ Gets the name of the wireless network the computer is currently coneected to.
+ """
+ return commands.getoutput("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I|grep \" SSID: \"|cut -c 18-")
def takeSnapshot():
"""
@@ -77,7 +81,10 @@ def takeSnapshot():
newFile.write("Now Playing: " + str(getCurrentlyPlaying()) + "\n")
# put front app in file.
- newFile.write("Current Application: " + str(getCurrentApp()) + "\n\n")
+ newFile.write("Current Application: " + str(getCurrentApp()) + "\n")
+
+ # put network in file.
+ newFile.write("Connected to: " + str(getCurrentNetworkName()) + "\n\n")
tracks = getRecentTracks(myLastFmUsername)
for track in tracks:

0 comments on commit 94d1552

Please sign in to comment.