Subsonic API: added user management commands
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -77,14 +77,20 @@ CustomTypeToString(Error::CustomType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case Error::CustomType::BadId:
|
||||
return "Bad id";
|
||||
case Error::CustomType::NotImplemented:
|
||||
return "Not implemented";
|
||||
case Error::CustomType::InternalError:
|
||||
case Error::CustomType::BadIdFormat:
|
||||
return "Bad id format";
|
||||
case Error::CustomType::BadPasswordFormat:
|
||||
return "Internal error";
|
||||
case Error::CustomType::InternalError:
|
||||
return "Bad password format";
|
||||
case Error::CustomType::LoginThrottled:
|
||||
return "Login throttled, too many attempts";
|
||||
case Error::CustomType::NotImplemented:
|
||||
return "Not implemented";
|
||||
case Error::CustomType::PasswordTooWeak:
|
||||
return "Password too weak";
|
||||
case Error::CustomType::UserAlreadyExists:
|
||||
return "User already exists";
|
||||
}
|
||||
|
||||
return "Unknown custom error";
|
||||
|
||||
@@ -48,10 +48,13 @@ class Error
|
||||
|
||||
enum class CustomType
|
||||
{
|
||||
BadId,
|
||||
NotImplemented,
|
||||
LoginThrottled,
|
||||
BadIdFormat,
|
||||
BadPasswordFormat,
|
||||
InternalError,
|
||||
LoginThrottled,
|
||||
NotImplemented,
|
||||
PasswordTooWeak,
|
||||
UserAlreadyExists,
|
||||
};
|
||||
|
||||
Error(Code code);
|
||||
|
||||
+12
-2
@@ -147,9 +147,19 @@ User::setAudioTranscodeBitrate(Bitrate bitrate)
|
||||
}
|
||||
|
||||
void
|
||||
User::setMaxAudioTranscodeBitrate(Bitrate bitrate)
|
||||
User::setMaxAudioTranscodeBitrate(Bitrate requestedBitrate)
|
||||
{
|
||||
_maxAudioTranscodeBitrate = std::min(bitrate, *audioTranscodeAllowedBitrates.rbegin());
|
||||
Bitrate bitrate {*audioTranscodeAllowedBitrates.begin()};
|
||||
|
||||
for (auto allowedBitrate : audioTranscodeAllowedBitrates)
|
||||
{
|
||||
if (requestedBitrate < allowedBitrate)
|
||||
break;
|
||||
|
||||
bitrate = allowedBitrate;
|
||||
}
|
||||
|
||||
_maxAudioTranscodeBitrate = bitrate;
|
||||
if (_audioTranscodeBitrate > _maxAudioTranscodeBitrate)
|
||||
_audioTranscodeBitrate = _maxAudioTranscodeBitrate;
|
||||
}
|
||||
|
||||
@@ -97,6 +97,12 @@ stringTrimEnd(const std::string& str, const std::string& whitespace)
|
||||
return str.substr(0, str.find_last_not_of(whitespace)+1);
|
||||
}
|
||||
|
||||
std::string
|
||||
stringToLower(const std::string& str)
|
||||
{
|
||||
return boost::algorithm::to_lower_copy(str);
|
||||
}
|
||||
|
||||
std::string
|
||||
bufferToString(const std::vector<unsigned char>& data)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,9 @@ stringTrim(const std::string& str, const std::string& whitespaces = " \t");
|
||||
std::string
|
||||
stringTrimEnd(const std::string& str, const std::string& whitespaces = " \t");
|
||||
|
||||
std::string
|
||||
stringToLower(const std::string& str);
|
||||
|
||||
std::string
|
||||
bufferToString(const std::vector<unsigned char>& data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user