Update Last.fm error codes

This commit is contained in:
Jonas Kvinge
2020-07-19 03:47:21 +02:00
parent df901c30ef
commit 7e6de528b4
2 changed files with 62 additions and 33 deletions

View File

@@ -428,7 +428,10 @@ QByteArray ScrobblingAPI20::GetReplyData(QNetworkReply *reply) {
reply->error() == QNetworkReply::ContentOperationNotPermittedError || reply->error() == QNetworkReply::ContentOperationNotPermittedError ||
reply->error() == QNetworkReply::AuthenticationRequiredError || reply->error() == QNetworkReply::AuthenticationRequiredError ||
error_code == ScrobbleErrorCode::InvalidSessionKey || error_code == ScrobbleErrorCode::InvalidSessionKey ||
error_code == ScrobbleErrorCode::AuthenticationFailed error_code == ScrobbleErrorCode::UnauthorizedToken ||
error_code == ScrobbleErrorCode::LoginRequired ||
error_code == ScrobbleErrorCode::AuthenticationFailed ||
error_code == ScrobbleErrorCode::APIKeySuspended
){ ){
// Session is probably expired // Session is probably expired
Logout(); Logout();
@@ -994,38 +997,66 @@ void ScrobblingAPI20::Error(const QString &error, const QVariant &debug) {
QString ScrobblingAPI20::ErrorString(const ScrobbleErrorCode error) const { QString ScrobblingAPI20::ErrorString(const ScrobbleErrorCode error) const {
switch (error) { switch (error) {
case ScrobbleErrorCode::NoError:
return QString("This error does not exist.");
case ScrobbleErrorCode::InvalidService: case ScrobbleErrorCode::InvalidService:
return QString("Invalid service - This service does not exist"); return QString("Invalid service - This service does not exist.");
case ScrobbleErrorCode::InvalidMethod: case ScrobbleErrorCode::InvalidMethod:
return QString("Invalid Method - No method with that name in this package"); return QString("Invalid Method - No method with that name in this package.");
case ScrobbleErrorCode::AuthenticationFailed: case ScrobbleErrorCode::AuthenticationFailed:
return QString("Authentication Failed - You do not have permissions to access the service"); return QString("Authentication Failed - You do not have permissions to access the service.");
case ScrobbleErrorCode::InvalidFormat: case ScrobbleErrorCode::InvalidFormat:
return QString("Invalid format - This service doesn't exist in that format"); return QString("Invalid format - This service doesn't exist in that format.");
case ScrobbleErrorCode::InvalidParameters: case ScrobbleErrorCode::InvalidParameters:
return QString("Invalid parameters - Your request is missing a required parameter"); return QString("Invalid parameters - Your request is missing a required parameter.");
case ScrobbleErrorCode::InvalidResourceSpecified: case ScrobbleErrorCode::InvalidResourceSpecified:
return QString("Invalid resource specified"); return QString("Invalid resource specified");
case ScrobbleErrorCode::OperationFailed: case ScrobbleErrorCode::OperationFailed:
return QString("Operation failed - Something else went wrong"); return QString("Operation failed - Most likely the backend service failed. Please try again.");
case ScrobbleErrorCode::InvalidSessionKey: case ScrobbleErrorCode::InvalidSessionKey:
return QString("Invalid session key - Please re-authenticate"); return QString("Invalid session key - Please re-authenticate.");
case ScrobbleErrorCode::InvalidApiKey: case ScrobbleErrorCode::InvalidApiKey:
return QString("Invalid API key - You must be granted a valid key by last.fm"); return QString("Invalid API key - You must be granted a valid key by last.fm.");
case ScrobbleErrorCode::ServiceOffline: case ScrobbleErrorCode::ServiceOffline:
return QString("Service Offline - This service is temporarily offline. Try again later."); return QString("Service Offline - This service is temporarily offline. Try again later.");
case ScrobbleErrorCode::SubscribersOnly:
return QString("Subscribers Only - This station is only available to paid last.fm subscribers.");
case ScrobbleErrorCode::InvalidMethodSignature: case ScrobbleErrorCode::InvalidMethodSignature:
return QString("Invalid method signature supplied"); return QString("Invalid method signature supplied.");
case ScrobbleErrorCode::TempError: case ScrobbleErrorCode::UnauthorizedToken:
return QString("There was a temporary error processing your request. Please try again"); return QString("Unauthorized Token - This token has not been authorized.");
case ScrobbleErrorCode::SuspendedAPIKey: case ScrobbleErrorCode::ItemUnavailable:
return QString("This item is not available for streaming.");
case ScrobbleErrorCode::TemporarilyUnavailable:
return QString("The service is temporarily unavailable, please try again.");
case ScrobbleErrorCode::LoginRequired:
return QString("Login: User requires to be logged in.");
case ScrobbleErrorCode::TrialExpired:
return QString("Trial Expired - This user has no free radio plays left. Subscription required.");
case ScrobbleErrorCode::ErrorDoesNotExist:
return QString("This error does not exist.");
case ScrobbleErrorCode::NotEnoughContent:
return QString("Not Enough Content - There is not enough content to play this station.");
case ScrobbleErrorCode::NotEnoughMembers:
return QString("Not Enough Members - This group does not have enough members for radio.");
case ScrobbleErrorCode::NotEnoughFans:
return QString("Not Enough Fans - This artist does not have enough fans for for radio.");
case ScrobbleErrorCode::NotEnoughNeighbours:
return QString("Not Enough Neighbours - There are not enough neighbours for radio.");
case ScrobbleErrorCode::NoPeakRadio:
return QString("No Peak Radio - This user is not allowed to listen to radio during peak usage.");
case ScrobbleErrorCode::RadioNotFound:
return QString("Radio Not Found - Radio station not found.");
case ScrobbleErrorCode::APIKeySuspended:
return QString("Suspended API key - Access for your account has been suspended, please contact Last.fm"); return QString("Suspended API key - Access for your account has been suspended, please contact Last.fm");
case ScrobbleErrorCode::Deprecated:
return QString("Deprecated - This type of request is no longer supported.");
case ScrobbleErrorCode::RateLimitExceeded: case ScrobbleErrorCode::RateLimitExceeded:
return QString("Rate limit exceeded - Your IP has made too many requests in a short period"); return QString("Rate limit exceeded - Your IP has made too many requests in a short period.");
default:
return QString("Unknown error");
} }
return QString("Unknown error.");
} }
void ScrobblingAPI20::CheckScrobblePrevSong() { void ScrobblingAPI20::CheckScrobblePrevSong() {

View File

@@ -88,7 +88,6 @@ class ScrobblingAPI20 : public ScrobblerService {
private: private:
enum ScrobbleErrorCode { enum ScrobbleErrorCode {
Unknown = 0,
NoError = 1, NoError = 1,
InvalidService = 2, InvalidService = 2,
InvalidMethod = 3, InvalidMethod = 3,
@@ -100,23 +99,22 @@ class ScrobblingAPI20 : public ScrobblerService {
InvalidSessionKey = 9, InvalidSessionKey = 9,
InvalidApiKey = 10, InvalidApiKey = 10,
ServiceOffline = 11, ServiceOffline = 11,
Reserved12 = 12, SubscribersOnly = 12,
InvalidMethodSignature = 13, InvalidMethodSignature = 13,
Reserved14 = 14, UnauthorizedToken = 14,
Reserved15 = 15, ItemUnavailable = 15,
TempError = 16, TemporarilyUnavailable = 16,
Reserved17 = 17, LoginRequired = 17,
Reserved18 = 18, TrialExpired = 18,
Reserved19 = 19, ErrorDoesNotExist = 19,
Reserved20 = 20, NotEnoughContent = 20,
Reserved21 = 21, NotEnoughMembers = 21,
Reserved22 = 22, NotEnoughFans = 22,
Reserved23 = 23, NotEnoughNeighbours = 23,
Reserved24 = 24, NoPeakRadio = 24,
Reserved25 = 25, RadioNotFound = 25,
SuspendedAPIKey = 26, APIKeySuspended = 26,
Reserved27 = 27, Deprecated = 27,
Reserved28 = 28,
RateLimitExceeded = 29, RateLimitExceeded = 29,
}; };