diff --git a/widgets/mpd.lua b/widgets/mpd.lua index e4bcb0b..b8d08df 100644 --- a/widgets/mpd.lua +++ b/widgets/mpd.lua @@ -37,10 +37,11 @@ local function worker(format, warg) -- Construct MPD client options local mpdh = "telnet://"..host..":"..port - local echo = "echo 'password "..pass.."\nstatus\ncurrentsong\nclose'" + local echo = '{ echo "password '..pass..'"; echo "status";' .. + 'echo "currentsong"; sleep .1; echo "close";}' -- Get data from MPD server - local f = io.popen(echo.." | curl --connect-timeout 1 -fsm 3 "..mpdh) + local f = io.popen(echo.." | curl --connect-timeout 1 -fs "..mpdh) for line in f:lines() do for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do