Released version 3-2015061300
[notion.git] / contrib / statusd / statusd_pytone.lua
blob87d6da897831f4fcfdc443df5861f69a7bd38457
1 -- Authors: Alexander Wirt <formorer@formorer.de>
2 -- License: Unknown
3 -- Last Changed: Unknown
4 --
5 -- Stolen from statusd_mpd.lua
6 -- Responsible for bugs and so on: Alexander Wirt <formorer@formorer.de>
7 -- To get this working you have to enable playerinfofile in your pytonerc
8 -- If you have the info file at an unusal place overwrite the infofile setting
10 if not statusd_pytone then
11 statusd_pytone={
12 interval=1*1000,
13 infofile=os.getenv("HOME").."/.pytone/playerinfo",
15 end
20 local function get_pytone_status()
21 local f=io.open(statusd_pytone.infofile,'r')
22 if not f then return "n/a" end
23 local playing=f:read()
24 return playing
25 end
27 local pytone_timer
29 local function update_pytone()
30 statusd.inform("pytone", get_pytone_status())
31 pytone_timer:set(statusd_pytone.interval, update_pytone)
32 end
34 -- Init
35 --get_inet_addr=get_inet_addr_fn()
36 pytone_timer=statusd.create_timer()
37 update_pytone()