Skip to content

Instantly share code, notes, and snippets.

@Voker57
Created October 9, 2009 11:25
Show Gist options
  • Save Voker57/205946 to your computer and use it in GitHub Desktop.
Save Voker57/205946 to your computer and use it in GitHub Desktop.
local defaults={
-- 500 or less makes seconds increment relatively smoothly while playing
update_interval=500
}
local settings=table.join(statusd.get_config("xmms2"), defaults)
local xmms2_timer
local function get_xmms2_status()
local xmms2 = io.popen("xmms2 current")
if xmms2 == nil then
return nil
else
local r = ""
local t = ""
repeat
r = r..t
t = xmms2:read()
until t == nil
return r
end
end
local function update_xmms2()
local xmms2_st = get_xmms2_status()
statusd.inform("xmms2", xmms2_st)
xmms2_timer:set(settings.update_interval, update_xmms2)
end
-- Init
xmms2_timer=statusd.create_timer()
update_xmms2()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment