mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-21 04:56:13 +02:00
kill shairport-sync and librespot if already running
This commit is contained in:
parent
c897b437f9
commit
748c4c06b1
3 changed files with 27 additions and 8 deletions
|
@ -54,6 +54,7 @@ SpotifyStream::~SpotifyStream()
|
|||
|
||||
void SpotifyStream::initExeAndPath(const std::string& filename)
|
||||
{
|
||||
path_ = "";
|
||||
exe_ = findExe(filename);
|
||||
if (!fileExists(exe_) || (exe_ == "/"))
|
||||
{
|
||||
|
@ -63,7 +64,13 @@ void SpotifyStream::initExeAndPath(const std::string& filename)
|
|||
}
|
||||
|
||||
if (exe_.find("/") != string::npos)
|
||||
path_ = exe_.substr(0, exe_.find_last_of("/"));
|
||||
{
|
||||
path_ = exe_.substr(0, exe_.find_last_of("/") + 1);
|
||||
exe_ = exe_.substr(exe_.find_last_of("/") + 1);
|
||||
}
|
||||
|
||||
/// kill if it's already running
|
||||
execGetOutput("killall " + exe_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,7 +100,7 @@ void SpotifyStream::onStderrMsg(const char* buffer, size_t n)
|
|||
(logmsg.find('\0') == string::npos) &&
|
||||
(logmsg.size() > 4))
|
||||
{
|
||||
logO << logmsg << "\n";
|
||||
logO << "(" << exe_ << ") " << logmsg << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue