mpd: workaround command termination bug in mpd server v0.18

See Debian bug report #728982 for more information.

Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
This commit is contained in:
joe di castro 2013-11-05 21:08:42 +01:00 committed by Adrian C. (anrxc)
parent c795642c2f
commit a6a73f47d6
1 changed files with 3 additions and 2 deletions

View File

@ -37,10 +37,11 @@ local function worker(format, warg)
-- Construct MPD client options -- Construct MPD client options
local mpdh = "telnet://"..host..":"..port 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 -- 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 line in f:lines() do
for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do