mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-30 01:16:16 +02:00
Making the librespot "username" and "password" params optional, and only throwing an error if one is provided without the the other.
This commit is contained in:
parent
0f2359c971
commit
1401ef76bd
1 changed files with 6 additions and 5 deletions
|
@ -37,12 +37,13 @@ SpotifyStream::SpotifyStream(PcmListener* pcmListener, const StreamUri& uri) : P
|
|||
string bitrate = uri_.getQuery("bitrate", "320");
|
||||
string devicename = uri_.getQuery("devicename", "Snapcast");
|
||||
|
||||
if (username.empty())
|
||||
throw SnapException("missing parameter \"username\"");
|
||||
if (password.empty())
|
||||
throw SnapException("missing parameter \"password\"");
|
||||
if (username.empty() != password.empty())
|
||||
throw SnapException("missing parameter \"username\" or \"password\" (must provide both, or neither)");
|
||||
|
||||
params_ = "--name \"" + devicename + "\" --username \"" + username + "\" --password \"" + password + "\" --bitrate " + bitrate + " --backend pipe";
|
||||
params_ = "--name \"" + devicename + "\"";
|
||||
if (!username.empty() && !password.empty())
|
||||
params_ += " --username \"" + username + "\" --password \"" + password + "\"";
|
||||
params_ += " --bitrate " + bitrate + " --backend pipe";
|
||||
// logO << "params: " << params << "\n";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue