mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-01 18:31:45 +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 bitrate = uri_.getQuery("bitrate", "320");
|
||||||
string devicename = uri_.getQuery("devicename", "Snapcast");
|
string devicename = uri_.getQuery("devicename", "Snapcast");
|
||||||
|
|
||||||
if (username.empty())
|
if (username.empty() != password.empty())
|
||||||
throw SnapException("missing parameter \"username\"");
|
throw SnapException("missing parameter \"username\" or \"password\" (must provide both, or neither)");
|
||||||
if (password.empty())
|
|
||||||
throw SnapException("missing parameter \"password\"");
|
|
||||||
|
|
||||||
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";
|
// logO << "params: " << params << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue