Released version 3-2014010502
[notion.git] / contrib / statusd / statusd_orpheus.lua
blob6d651a589511faef434e2ed52bb2a287dab8715f
1 -- Authors: Norbert Tretkowski <norbert@tretkowski.de>
2 -- License: Unknown
3 -- Last Changed: Unknown
4 --
5 -- Stolen from statusd_pytone.lua by Norbert Tretkowski <norbert@tretkowski.de>
7 if not statusd_orpheus then
8 statusd_orpheus={
9 interval=1*1000,
10 infofile=os.getenv("HOME").."/.orpheus/currently_playing",
12 end
14 local function get_orpheus_status()
15 local f=io.open(statusd_orpheus.infofile,'r')
16 if not f then return "n/a" end
17 local playing=f:read()
18 return playing
19 end
21 local orpheus_timer
23 local function update_orpheus()
24 statusd.inform("orpheus", get_orpheus_status())
25 orpheus_timer:set(statusd_orpheus.interval, update_orpheus)
26 end
28 -- Init
29 --get_inet_addr=get_inet_addr_fn()
30 orpheus_timer=statusd.create_timer()
31 update_orpheus()