Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Hi #2

Open
wants to merge 4 commits into from

1 participant

@dcellucci

Robin Sloan tweeted your project and I became interested. I don't know much python, but I added a plugin to check the battery power. I also moved things so that all the plugins are in their own directory (hu still searches for folders that start with hu_). As far as I can tell it works.

I also started writing a version for ruby that is packaged in a gem and uses a command line interface. That isn't in this pull request though. This pull request is still in python.

Thanks for reading!
DC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 20, 2012
  1. @dcellucci
  2. @dcellucci

    Added a plugin (battery power), tried to fix another, moved plugins t…

    dcellucci authored
    …o their own folder. Need to commit more often
  3. @dcellucci
Commits on Jun 21, 2012
  1. @dcellucci

    fixed rm/git rm thing

    dcellucci authored
This page is out of date. Refresh to see the latest.
Showing with 99 additions and 96 deletions.
  1. +14 −0 .gitignore
  2. +0 −72 hu-notes.txt
  3. +7 −5 hu.py
  4. BIN  hu_currentlyplaying/__init__.pyc
  5. BIN  hu_currentlyplaying/hu_currentlyplaying.pyc
  6. BIN  hu_googleweather/__init__.pyc
  7. BIN  hu_googleweather/hu_googleweather.pyc
  8. BIN  hu_lastfm/__init__.pyc
  9. BIN  hu_lastfm/pylast.pyc
  10. BIN  hu_openapps/__init__.pyc
  11. BIN  hu_openbrowsertabs/__init__.pyc
  12. BIN  hu_openbrowsertabs/hu_openbrowsertabs.pyc
  13. +0 −15 hu_openbrowsertabs/urls.applescript
  14. BIN  hu_ssidname/__init__.pyc
  15. 0  plugins/__init__.py
  16. BIN  plugins/__init__.pyc
  17. +1 −0  plugins/hu_batterypower/__init__.py
  18. BIN  plugins/hu_batterypower/__init__.pyc
  19. +56 −0 plugins/hu_batterypower/hu_batterypower.py
  20. BIN  plugins/hu_batterypower/hu_batterypower.pyc
  21. 0  { → plugins}/hu_currentlyplaying/__init__.py
  22. BIN  plugins/hu_currentlyplaying/__init__.pyc
  23. 0  { → plugins}/hu_currentlyplaying/currentlyPlaying.applescript
  24. 0  { → plugins}/hu_currentlyplaying/hu_currentlyplaying.py
  25. BIN  plugins/hu_currentlyplaying/hu_currentlyplaying.pyc
  26. 0  { → plugins}/hu_googleweather/__init__.py
  27. BIN  plugins/hu_googleweather/__init__.pyc
  28. +1 −1  { → plugins}/hu_googleweather/hu_googleweather.py
  29. BIN  plugins/hu_googleweather/hu_googleweather.pyc
  30. 0  { → plugins}/hu_googleweather/pywapi.py
  31. BIN  { → plugins}/hu_googleweather/pywapi.pyc
  32. 0  { → plugins}/hu_lastfm/__init__.py
  33. BIN  plugins/hu_lastfm/__init__.pyc
  34. +1 −1  { → plugins}/hu_lastfm/hu_lastfm.py
  35. BIN  { → plugins}/hu_lastfm/hu_lastfm.pyc
  36. 0  { → plugins}/hu_lastfm/pylast.py
  37. BIN  plugins/hu_lastfm/pylast.pyc
  38. 0  { → plugins}/hu_openapps/__init__.py
  39. BIN  plugins/hu_openapps/__init__.pyc
  40. 0  { → plugins}/hu_openapps/hu_openapps.py
  41. BIN  { → plugins}/hu_openapps/hu_openapps.pyc
  42. +2 −1  { → plugins}/hu_openapps/openapps.applescript
  43. 0  { → plugins}/hu_openbrowsertabs/__init__.py
  44. BIN  plugins/hu_openbrowsertabs/__init__.pyc
  45. +1 −1  { → plugins}/hu_openbrowsertabs/hu_openbrowsertabs.py
  46. BIN  plugins/hu_openbrowsertabs/hu_openbrowsertabs.pyc
  47. +16 −0 plugins/hu_openbrowsertabs/urls.applescript
  48. 0  { → plugins}/hu_ssidname/__init__.py
  49. BIN  plugins/hu_ssidname/__init__.pyc
  50. 0  { → plugins}/hu_ssidname/hu_ssidname.py
  51. BIN  { → plugins}/hu_ssidname/hu_ssidname.pyc
View
14 .gitignore
@@ -0,0 +1,14 @@
+# Privacy #
+##################
+hu-notes.txt
+
+# Basic OS Stuff #
+##################
+.DS_Store
+.DS_Store?
+._*
+.Spotlight-V100
+.Trashes
+Icon?
+ehthumbs.db
+Thumbs.db
View
72 hu-notes.txt
@@ -1,72 +0,0 @@
-<hu>
-<entry time="Tue, 29 Jun 2010 13:04:13">
-<weather location="brisbane,australia" condition="Partly Cloudy" temp="16c"/>
-<ssid name="Simon" />
-<browser>
-<tab title="Stephen King - On Writing (Audiobook) (download torrent) - TPB" url="http://thepiratebay.org/torrent/4238993/Stephen_King_-_On_Writing_(Audiobook)" />
-<tab title="The.Pixar.Story.(2007).TV-RIP-PinkyBrainz.mp4 (download torrent) - TPB" url="http://thepiratebay.org/torrent/4171274/The.Pixar.Story.(2007).TV-RIP-PinkyBrainz.mp4" />
-<tab title="Welcome To Macintosh (2008) (download torrent) - TPB" url="http://thepiratebay.org/torrent/4758559/Welcome_To_Macintosh_(2008)" />
-</browser>
-<applications>
-<app name="Mail" />
-<app name="iTunes" />
-<app name="Terminal" />
-<app name="TextMate" />
-<app name="Safari" />
-</applications>
-</entry>
-<entry time="Tue, 29 Jun 2010 13:14:14">
-<currentlyplaying artist="U2" title="Zoo Station" />
-<weather location="brisbane,australia" condition="Partly Cloudy" temp="16c"/>
-<lastfm>
-<track artist="Ramones" title="Chainsaw" time="1277780961" />
-<track artist="Jessica Harper" title="Carte Blanche" time="1277780878" />
-<track artist="Big Star" title="In The Street" time="1277780705" />
-</lastfm>
-<applications>
-<app name="Mail" />
-<app name="iTunes" />
-<app name="Terminal" />
-<app name="TextMate" />
-<app name="Safari" />
-</applications>
-<browser>
-<tab title="python list directories - Google Search" url="http://www.google.com/search?q=python%20list%20directories&ie=utf-8&oe=utf-8" />
-<tab title="10.1. os.path — Common pathname manipulations — Python v2.6.5 documentation" url="http://docs.python.org/library/os.path.html#module-os.path" />
-<tab title="10.1. os.path — Common pathname manipulations — Python v2.6.5 documentation" url="http://docs.python.org/library/os.path.html" />
-<tab title="15.1. os — Miscellaneous operating system interfaces — Python v2.6.5 documentation" url="http://docs.python.org/library/os.html" />
-<tab title="How do I execute a string containing Python code in Python? - Stack Overflow" url="http://stackoverflow.com/questions/701802/how-do-i-execute-a-string-containing-python-code-in-python" />
-<tab title="Stephen King - On Writing (Audiobook) (download torrent) - TPB" url="http://thepiratebay.org/torrent/4238993/Stephen_King_-_On_Writing_(Audiobook)" />
-<tab title="The.Pixar.Story.(2007).TV-RIP-PinkyBrainz.mp4 (download torrent) - TPB" url="http://thepiratebay.org/torrent/4171274/The.Pixar.Story.(2007).TV-RIP-PinkyBrainz.mp4" />
-<tab title="Welcome To Macintosh (2008) (download torrent) - TPB" url="http://thepiratebay.org/torrent/4758559/Welcome_To_Macintosh_(2008)" />
-</browser>
-<ssid name="Simon" />
-</entry>
-<entry time="Tue, 29 Jun 2010 13:17:19">
-<currentlyplaying artist="Richard O'Brien, Jessica Harper, Patricia Quinn, Barry Humphries" title="Little Black Dress" />
-<weather location="brisbane,australia" condition="Partly Cloudy" temp="16c"/>
-<lastfm>
-<track artist="U2" title="Zoo Station" time="1277781051" />
-<track artist="Ramones" title="Chainsaw" time="1277780961" />
-<track artist="Jessica Harper" title="Carte Blanche" time="1277780878" />
-</lastfm>
-<applications>
-<app name="Mail" />
-<app name="iTunes" />
-<app name="Terminal" />
-<app name="TextMate" />
-<app name="Safari" />
-</applications>
-<browser>
-<tab title="python list directories - Google Search" url="http://www.google.com/search?q=python%20list%20directories&ie=utf-8&oe=utf-8" />
-<tab title="10.1. os.path — Common pathname manipulations — Python v2.6.5 documentation" url="http://docs.python.org/library/os.path.html#module-os.path" />
-<tab title="10.1. os.path — Common pathname manipulations — Python v2.6.5 documentation" url="http://docs.python.org/library/os.path.html" />
-<tab title="15.1. os — Miscellaneous operating system interfaces — Python v2.6.5 documentation" url="http://docs.python.org/library/os.html" />
-<tab title="How do I execute a string containing Python code in Python? - Stack Overflow" url="http://stackoverflow.com/questions/701802/how-do-i-execute-a-string-containing-python-code-in-python" />
-<tab title="Stephen King - On Writing (Audiobook) (download torrent) - TPB" url="http://thepiratebay.org/torrent/4238993/Stephen_King_-_On_Writing_(Audiobook)" />
-<tab title="The.Pixar.Story.(2007).TV-RIP-PinkyBrainz.mp4 (download torrent) - TPB" url="http://thepiratebay.org/torrent/4171274/The.Pixar.Story.(2007).TV-RIP-PinkyBrainz.mp4" />
-<tab title="Welcome To Macintosh (2008) (download torrent) - TPB" url="http://thepiratebay.org/torrent/4758559/Welcome_To_Macintosh_(2008)" />
-</browser>
-<ssid name="Simon" />
-</entry>
-</hu>
View
12 hu.py
@@ -1,6 +1,6 @@
import datetime
import time
-import os
+import os, sys, inspect
class hu:
@@ -17,12 +17,14 @@ def __init__(self):
this is the part where i find out all of the things you want me to record.
"""
-
+ #cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
+ #if cmd_folder not in sys.path:
+ # sys.path.insert(0, cmd_folder)
# get names of all folders in the current directory that start with "hu_"
- for file in os.listdir("."):
+ for file in os.listdir("./plugins/"):
if file[0:3] == "hu_":
- exec "import " + file + "." + file
- exec "self.plugin_modules.append(" + file + "." + file + ")"
+ exec "import plugins." + file + "." + file
+ exec "self.plugin_modules.append(plugins." + file + "." + file + ")"
def takeSnapshot(self):
"""
View
BIN  hu_currentlyplaying/__init__.pyc
Binary file not shown
View
BIN  hu_currentlyplaying/hu_currentlyplaying.pyc
Binary file not shown
View
BIN  hu_googleweather/__init__.pyc
Binary file not shown
View
BIN  hu_googleweather/hu_googleweather.pyc
Binary file not shown
View
BIN  hu_lastfm/__init__.pyc
Binary file not shown
View
BIN  hu_lastfm/pylast.pyc
Binary file not shown
View
BIN  hu_openapps/__init__.pyc
Binary file not shown
View
BIN  hu_openbrowsertabs/__init__.pyc
Binary file not shown
View
BIN  hu_openbrowsertabs/hu_openbrowsertabs.pyc
Binary file not shown
View
15 hu_openbrowsertabs/urls.applescript
@@ -1,15 +0,0 @@
-set urls to ""
-tell application "Safari"
- set window_list to windows
- repeat with w in window_list
- try
- set tab_list to tabs of w
- repeat with t in tab_list
- set urls to urls & "<tab " & "title=\"" & name of t & "\" url=\"" & URL of t & "\" />\n"
- end repeat
- on error
- -- not all windows have tabs
- end try
- end repeat
-get urls
-end tell
View
BIN  hu_ssidname/__init__.pyc
Binary file not shown
View
0  plugins/__init__.py
No changes.
View
BIN  plugins/__init__.pyc
Binary file not shown
View
1  plugins/hu_batterypower/__init__.py
@@ -0,0 +1 @@
+import hu_batterypower
View
BIN  plugins/hu_batterypower/__init__.pyc
Binary file not shown
View
56 plugins/hu_batterypower/hu_batterypower.py
@@ -0,0 +1,56 @@
+import commands
+
+def getData():
+ """
+ uses the pmset command to find battery information
+ """
+ powerInfo = commands.getoutput("pmset -g ps")
+
+ ouputString = ""
+ powerState = ""
+ powerSource = ""
+ powerState = ""
+ percentage = ""
+ time = ""
+
+ if "AC Power" in powerInfo:
+ powerSource = "AC"
+ elif "Battery" in powerInfo:
+ powerSource = "Battery"
+ if "charged" in powerInfo:
+ powerState = "Charged"
+ else:
+ if "discharging" in powerInfo:
+ powerState = "Discharging"
+ else:
+ powerState = "Charging"
+ if powerState != "":
+ percentOffset = powerInfo.find("%")
+ percentage = powerInfo[percentOffset-2:percentOffset]
+ if percentage[0] == " ":
+ percentage = percentage[1:]
+ timeOffset = powerInfo.find(":")
+ if timeOffset >= 0:
+ time = powerInfo[timeOffset-2:timeOffset+3]
+ if time[0] == " ":
+ time = time[1:]
+ if powerState != "":
+ outputString = "<power state=\"" + powerState + "\""
+ if powerSource != "":
+ outputString = outputString + " source=\"" + powerSource + "\""
+ if percentage != "":
+ outputString = outputString + " percent=\"" + percentage + "%\""
+ if time != "":
+ outputString = outputString + " time=\"" + time + "\""
+ outputString = outputString + "/>"
+ return outputString
+
+
+
+
+
+
+
+
+
+
View
BIN  plugins/hu_batterypower/hu_batterypower.pyc
Binary file not shown
View
0  hu_currentlyplaying/__init__.py → plugins/hu_currentlyplaying/__init__.py
File renamed without changes
View
BIN  plugins/hu_currentlyplaying/__init__.pyc
Binary file not shown
View
0  ...entlyplaying/currentlyPlaying.applescript → ...entlyplaying/currentlyPlaying.applescript
File renamed without changes
View
0  hu_currentlyplaying/hu_currentlyplaying.py → ...u_currentlyplaying/hu_currentlyplaying.py
File renamed without changes
View
BIN  plugins/hu_currentlyplaying/hu_currentlyplaying.pyc
Binary file not shown
View
0  hu_googleweather/__init__.py → plugins/hu_googleweather/__init__.py
File renamed without changes
View
BIN  plugins/hu_googleweather/__init__.pyc
Binary file not shown
View
2  hu_googleweather/hu_googleweather.py → plugins/hu_googleweather/hu_googleweather.py
@@ -1,4 +1,4 @@
-location = "brisbane,australia"
+location = "athens, georgia, USA"
import pywapi
View
BIN  plugins/hu_googleweather/hu_googleweather.pyc
Binary file not shown
View
0  hu_googleweather/pywapi.py → plugins/hu_googleweather/pywapi.py
File renamed without changes
View
BIN  hu_googleweather/pywapi.pyc → plugins/hu_googleweather/pywapi.pyc
Binary file not shown
View
0  hu_lastfm/__init__.py → plugins/hu_lastfm/__init__.py
File renamed without changes
View
BIN  plugins/hu_lastfm/__init__.pyc
Binary file not shown
View
2  hu_lastfm/hu_lastfm.py → plugins/hu_lastfm/hu_lastfm.py
@@ -1,4 +1,4 @@
-lastfm_username="scottjacksonx"
+lastfm_username="gendanvs"
import pylast as lastfm
import time
View
BIN  hu_lastfm/hu_lastfm.pyc → plugins/hu_lastfm/hu_lastfm.pyc
Binary file not shown
View
0  hu_lastfm/pylast.py → plugins/hu_lastfm/pylast.py
File renamed without changes
View
BIN  plugins/hu_lastfm/pylast.pyc
Binary file not shown
View
0  hu_openapps/__init__.py → plugins/hu_openapps/__init__.py
File renamed without changes
View
BIN  plugins/hu_openapps/__init__.pyc
Binary file not shown
View
0  hu_openapps/hu_openapps.py → plugins/hu_openapps/hu_openapps.py
File renamed without changes
View
BIN  hu_openapps/hu_openapps.pyc → plugins/hu_openapps/hu_openapps.pyc
Binary file not shown
View
3  hu_openapps/openapps.applescript → plugins/hu_openapps/openapps.applescript
@@ -2,7 +2,8 @@ tell application "System Events"
set theApps to (name of every process whose visible is true and name is not "Finder" and name is not (my name as text))
set appList to ""
repeat with appName in theApps
- set appList to appList & "<app name=\"" & appName & "\" />\n"
+ set appList to appList & "<app name=\"" & appName & "\" />
+"
end repeat
get appList
end tell
View
0  hu_openbrowsertabs/__init__.py → plugins/hu_openbrowsertabs/__init__.py
File renamed without changes
View
BIN  plugins/hu_openbrowsertabs/__init__.pyc
Binary file not shown
View
2  hu_openbrowsertabs/hu_openbrowsertabs.py → .../hu_openbrowsertabs/hu_openbrowsertabs.py
@@ -4,7 +4,7 @@ def getData():
"""
Gets the title and URL of every tab open in the specified web browser.
"""
- urls = commands.getoutput("osascript hu_openbrowsertabs/urls.applescript")
+ urls = commands.getoutput("osascript hu_openbrowsertabs/urls.applescript \"Google Chrome\"")
if urls[0:18] != "hu_openbrowsertabs":
return "<browser>\n" + urls + "</browser>"
return ""
View
BIN  plugins/hu_openbrowsertabs/hu_openbrowsertabs.pyc
Binary file not shown
View
16 plugins/hu_openbrowsertabs/urls.applescript
@@ -0,0 +1,16 @@
+set urls to ""
+tell application "Google Chrome"
+ set window_list to windows
+ repeat with w in window_list
+ try
+ set tab_list to tabs of w
+ repeat with t in tab_list
+ set urls to urls & "<tab " & "title=\"" & title of t & "\" url=\"" & URL of t & "\" />
+"
+ end repeat
+ on error
+ -- not all windows have tabs
+ end try
+ end repeat
+ get urls
+end tell
View
0  hu_ssidname/__init__.py → plugins/hu_ssidname/__init__.py
File renamed without changes
View
BIN  plugins/hu_ssidname/__init__.pyc
Binary file not shown
View
0  hu_ssidname/hu_ssidname.py → plugins/hu_ssidname/hu_ssidname.py
File renamed without changes
View
BIN  hu_ssidname/hu_ssidname.pyc → plugins/hu_ssidname/hu_ssidname.pyc
Binary file not shown
Something went wrong with that request. Please try again.