Closed francois2metz closed 11 years ago
Don't you miss the client.fetch_idle()
after issuing send_idle()
? I am successfully using the idle command as follows:
self.idler.send_idle()
changed = self.idler.fetch_idle()
The problem is of course that fetch_idle()
blocks, so you would need another thread for the noidle()
command.
On 04/09/2013 09:45 AM, Michael Helmling wrote:
Don't you miss the |client.fetch_idle()| after issuing |send_idle()|? I am successfully using the idle command as follows:
self.idler.send_idle() changed = self.idler.fetch_idle() The problem is of course that |fetch_idle()| blocks, so you would need another thread for the |noidle()| command.
The idle command works. The problem is noidle.
From the readme:
Currently MPDClient is NOT thread-safe. As it use a socket internaly, only one thread can send or receive at the time.
François https://stormz.me
As far as I understand you have to send fetch_idle()
after send_idle()
(or use the "select" method as noted in the readme), and that's why your code fails.
only one thread can send or receive at the time.
I know that, but I am using noidle() from a different thread without problems. :-) In fact I don't know how else I should terminate an idling thread when the connection is to be closed.
Try send_noidle() instead.
Normally, if you use send_ command a fetch_command is expected. Idle and noidle is special case, which isn't currently treated. So this is a bug.
I may have wrong, but actually the noidle command doesn't works.
If I want to stop idling to quering the status for instance, I have to cancel idling with the noidle command.
I'm working on a patch to cancel the idle command when sending noidle, but any insights is welcome.