Add option to not kill all librespot instances

This commit is contained in:
Christian Flach 2020-01-30 14:15:54 +01:00
parent 2158c3e085
commit 678f102a98
No known key found for this signature in database
GPG key ID: 02D48802CD830869
3 changed files with 10 additions and 4 deletions

View file

@ -44,6 +44,7 @@ LibrespotStream::LibrespotStream(PcmListener* pcmListener, boost::asio::io_conte
string devicename = uri_.getQuery("devicename", "Snapcast");
string onevent = uri_.getQuery("onevent", "");
bool normalize = (uri_.getQuery("normalize", "false") == "true");
killall_ = (uri_.getQuery("killall", "true") == "true");
if (username.empty() != password.empty())
throw SnapException("missing parameter \"username\" or \"password\" (must provide both, or neither)");
@ -87,8 +88,11 @@ void LibrespotStream::initExeAndPath(const std::string& filename)
exe_ = exe_.substr(exe_.find_last_of("/") + 1);
}
/// kill if it's already running
execGetOutput("killall " + exe_);
if (killall_)
{
/// kill if it's already running
execGetOutput("killall " + exe_);
}
}