Open carnager opened 7 years ago
I agree this doesn't work too well currently. I think if you try again after the failed connection it will reconnect but it's not a great workflow at present.
-- Alan Berndt
On Aug 12, 2017 05:49, "Rasmus Steinke" notifications@github.com wrote:
!/usr/bin/env perl
# use Net::MPD;
my $mpd = Net::MPD->connect($ENV{MPD_HOST} // $mpd_host // 'localhost');
sleep 121;
$mpd->add('flac/Twisted Roots/1993 Turn to Stone/06-Trax.flac')
result:
perl foo.pl Error reading line from socket at foo.pl line 9.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bentglasstube/Net-MPD/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbaJc5JhofckrOl1njRGs4YwJNNWrqoks5sXZ9NgaJpZM4O1Z_e .
result:
Documentation says:
So I tried to add a
$mpd->close();
line before the sleep, which gives a reading socket error on the close command, which ends the script instantly without ever going to the sleep.Then I put the close command into a try block. Which resulted in the same behavior as the original script above.
Finally I closed the socket itself after the close command. The final script looks like this now:
Which finally had the desired result.
So actually there are 2 bugs here:
Also I think that both above issues should be done automatically without the user having to close down the socket manually before idle times.