Media library: prevent looping when mopidy is sent 'listallinfo' command

This commit is contained in:
Andrzej Rybczak
2017-03-26 11:17:03 +02:00
parent 4fcfb3c851
commit 0185ee7fa4

View File

@@ -61,6 +61,17 @@ MPD::SongIterator getDatabaseIterator(MPD::Connection &mpd)
else
throw;
}
catch (MPD::ServerError &e)
{
// mopidy blacklists 'listallinfo' command by default and throws server
// error when it receives it. Work around that to prevent ncmpcpp from
// continuously retrying to send the command and looping.
if (strstr(e.what(), "listallinfo") != nullptr
&& strstr(e.what(), "disabled") != nullptr)
Statusbar::print("Unable to fetch the data, server refused to process 'listallinfo' command");
else
throw;
}
return result;
}