From b014abfa03cf1e50db8e0ebee1ed8cd5a7b9ecde Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Mon, 1 Jun 2015 20:34:53 -0700 Subject: Add np tool --- np/.gitignore | 1 + np/README.md | 18 ++++++++++++++++++ np/np.moon | 9 +++++++++ 3 files changed, 28 insertions(+) create mode 100644 np/.gitignore create mode 100644 np/README.md create mode 100644 np/np.moon 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 .. "'" -- cgit v1.2.3