From 59c879e69de73314cc7cecb47a78193a25188afb Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 15 Mar 2009 22:13:49 +0100 Subject: [PATCH] handle responses other than OK returned by audioscrobbler --- src/scrobby.cpp | 14 +++++++++++++- src/song.cpp | 12 +++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/scrobby.cpp b/src/scrobby.cpp index 6ef8269..1f8078c 100644 --- a/src/scrobby.cpp +++ b/src/scrobby.cpp @@ -245,7 +245,19 @@ namespace size_t i = result.find("\n"); myHandshake.Status = result.substr(0, i); if (myHandshake.Status != "OK") - return false; + { + if (myHandshake.Status == "BANNED") + { + Log(llInfo, "Ops, this version of scrobby is banned. Please update to the newest one or if it's the newest, inform me about it (electricityispower@gmail.com)"); + } + else if (myHandshake.Status == "BADAUTH") + { + Log(llInfo, "User authentication failed. Please recheck your username/password settings."); + } + else + return false; + exit(1); + } result = result.substr(i+1); i = result.find("\n"); myHandshake.SessionID = result.substr(0, i); diff --git a/src/song.cpp b/src/song.cpp index 4e060b8..8cdccb5 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -243,13 +243,11 @@ bool MPD::Song::SendQueue() else { Log(llInfo, "Audioscrobbler returned status %s", result.c_str()); - if (result == "BADSESSION") - { - myHandshake.Lock(); - myHandshake.Clear(); // handshake probably failed if we are here, so reset it - myHandshake.Unlock(); - Log(llVerbose, "Handshake reset"); - } + // BADSESSION or FAILED was returned, handshake needs resetting. + myHandshake.Lock(); + myHandshake.Clear(); + myHandshake.Unlock(); + Log(llVerbose, "Handshake reset"); } return false; } -- 2.11.4.GIT