Permalink
Browse files

Hu now notes things in a way that looks a little nicer.

  • Loading branch information...
1 parent f7b4314 commit 430b996d054e965906b5fbcbaa65fb5165a9be93 @scottjacksonx committed May 25, 2010
Showing with 8 additions and 5 deletions.
  1. +8 −5 hu.py
View
13 hu.py
@@ -16,7 +16,7 @@ def getWeather(location):
googleWeather = pywapi.get_weather_from_google(location)
condition = googleWeather['current_conditions']['condition']
temp = googleWeather['current_conditions']['temp_c']
- return "Weather: " + condition + ", " + temp + "c" + "\n"
+ return "Weather: " + condition + ", " + temp + "c"
def getCurrentlyPlaying():
"""
@@ -37,7 +37,7 @@ def getRecentTracks(username):
for track in recentTracks:
now = time.time()
- if int(track[2]) + 600 > now: # track was played < ten minutes (600 seconds) ago.
+ if int(track[2]) + 600 > now: # track was played < 10 minutes (600 seconds) ago.
tracksFromLastTenMinutes.append(track)
return tracksFromLastTenMinutes
@@ -60,17 +60,20 @@ def takeSnapshot():
newFile = open("hu-notes/hu-" + str(currentTime), "w")
# put time in file
- newFile.write(str(datetime.date.fromtimestamp(currentTime)) + "\n")
+ snapshotTime = str(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()))
+ newFile.write(snapshotTime + "\n")
# put weather in file.
newFile.write(getWeather(myLocation) + "\n")
# put current track in file.
- newFile.write("Now Listening to: " + str(getCurrentlyPlaying()) + "\n")
+ newFile.write("Now Playing: " + str(getCurrentlyPlaying()) + "\n\n")
tracks = getRecentTracks(myLastFmUsername)
for track in tracks:
- newFile.write("Recently Listened: " + str(track[0]) + " | listened at " + str(track[2]) + "\n\n")
+ newFile.write("Recently Played: " + str(track[0]) + " | listened at " + str(track[2]) + "\n")
+
+ newFile.write("\n")
# put current tabs in file.
newFile.write(str(getOpenBrowserTabs(myBrowser)))

0 comments on commit 430b996

Please sign in to comment.