aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Dodrill <xena@yolo-swag.com>2015-06-01 20:34:53 -0700
committerChristine Dodrill <xena@yolo-swag.com>2015-06-01 20:35:02 -0700
commitb014abfa03cf1e50db8e0ebee1ed8cd5a7b9ecde (patch)
treea42387449fb76030064e0c6a4321ffc166c8d564
parent2b0eb3b2ab8563990710c287fe207dae9222417a (diff)
downloadx-b014abfa03cf1e50db8e0ebee1ed8cd5a7b9ecde.tar.xz
x-b014abfa03cf1e50db8e0ebee1ed8cd5a7b9ecde.zip
Add np tool
-rw-r--r--np/.gitignore1
-rw-r--r--np/README.md18
-rw-r--r--np/np.moon9
3 files changed, 28 insertions, 0 deletions
diff --git a/np/.gitignore b/np/.gitignore
new file mode 100644
index 0000000..d907c43
--- /dev/null
+++ b/np/.gitignore
@@ -0,0 +1 @@
+*.lua
diff --git a/np/README.md b/np/README.md
new file mode 100644
index 0000000..2ba4aff
--- /dev/null
+++ b/np/README.md
@@ -0,0 +1,18 @@
+NP
+==
+
+Get the current song from [Ponyville FM](http://ponyvillefm.com) via the
+[Ponyville Live](http://ponyvillelive.com) API.
+
+Dependencies
+------------
+
+- `luasocket`
+- `lua-cjson`
+
+Usage
+-----
+
+Run `np.moon` via some process manager to update
+[status](https://github.com/Xe/status) with the now playing song on
+Ponyville FM.
diff --git a/np/np.moon b/np/np.moon
new file mode 100644
index 0000000..d36e22d
--- /dev/null
+++ b/np/np.moon
@@ -0,0 +1,9 @@
+http = require "socket.http"
+cjson = require "cjson"
+
+main = do
+ resp = http.request "http://ponyvillelive.com/api/nowplaying/index/station/ponyvillefm"
+
+ obj = cjson.decode resp
+
+ os.execute "status '" .. obj.result.streams[2].current_song.text .. "'"