diff --git a/Changelog b/Changelog
index fcb5d4bc0..674169fff 100644
--- a/Changelog
+++ b/Changelog
@@ -13,7 +13,7 @@ Unreleased:
* Fixed key up causing playback to reset
* New improved last.fm and musicbrainz album cover providers
* Removed liblastfm dependency
- * Replace sha2 with QCryptographicHash
+ * Replaced sha2 with QCryptographicHash
Version 0.4.2:
diff --git a/src/scrobbler/listenbrainzscrobbler.cpp b/src/scrobbler/listenbrainzscrobbler.cpp
index 3babff4ad..aa1770c3f 100644
--- a/src/scrobbler/listenbrainzscrobbler.cpp
+++ b/src/scrobbler/listenbrainzscrobbler.cpp
@@ -144,10 +144,9 @@ void ListenBrainzScrobbler::Authenticate() {
bool result = QDesktopServices::openUrl(url);
if (!result) {
- QMessageBox box(QMessageBox::NoIcon, "Scrobbler Authentication", QString("Please open this URL in your browser: %1").arg(url.toString()), QMessageBox::Ok);
- box.setTextFormat(Qt::RichText);
- qLog(Debug) << "Scrobbler authentication URL: " << url.toString();
- box.exec();
+ QMessageBox messagebox(QMessageBox::Information, "ListenBrainz Authentication", QString("Please open this URL in your browser:
%1").arg(url.toString()), QMessageBox::Ok);
+ messagebox.setTextFormat(Qt::RichText);
+ messagebox.exec();
}
}
@@ -241,7 +240,7 @@ void ListenBrainzScrobbler::AuthenticateReplyFinished(QNetworkReply *reply) {
}
if (!json_obj.contains("access_token") || !json_obj.contains("expires_in") || !json_obj.contains("token_type") || !json_obj.contains("refresh_token")) {
- AuthError("Json session object is missing values.");
+ AuthError("Json access_token, expires_in or token_type is missing.");
return;
}
@@ -289,7 +288,7 @@ QByteArray ListenBrainzScrobbler::GetReplyData(QNetworkReply *reply) {
Error(error_reason);
}
else {
- // See if there is Json data containing "error" and "error_description" - then use that instead.
+ // See if there is Json data containing "code" and "error" - then use that instead.
data = reply->readAll();
QJsonParseError error;
QJsonDocument json_doc = QJsonDocument::fromJson(data, &error);
@@ -299,8 +298,8 @@ QByteArray ListenBrainzScrobbler::GetReplyData(QNetworkReply *reply) {
QJsonObject json_obj = json_doc.object();
if (json_obj.contains("code") && json_obj.contains("error")) {
error_code = json_obj["code"].toInt();
- QString message = json_obj["error"].toString();
- error_reason = QString("%1 (%2)").arg(message).arg(error_code);
+ QString error_message = json_obj["error"].toString();
+ error_reason = QString("%1 (%2)").arg(error_message).arg(error_code);
}
else {
error_reason = QString("%1 (%2)").arg(reply->errorString()).arg(reply->error());
@@ -460,7 +459,7 @@ void ListenBrainzScrobbler::ScrobbleRequestFinished(QNetworkReply *reply, QList<
if (json_obj.contains("status")) {
QString status = json_obj["status"].toString();
- qLog(Debug) << "MusicBrainz: Received scrobble status:" << status;
+ qLog(Debug) << "ListenBrainz: Received scrobble status:" << status;
}
cache_->Flush(list);
diff --git a/src/scrobbler/scrobblingapi20.cpp b/src/scrobbler/scrobblingapi20.cpp
index f7e25c83b..6410c3f0f 100644
--- a/src/scrobbler/scrobblingapi20.cpp
+++ b/src/scrobbler/scrobblingapi20.cpp
@@ -22,7 +22,9 @@
#include
#include
+#include
#include
+#include
#include
#include
#include
@@ -131,12 +133,27 @@ void ScrobblingAPI20::Authenticate() {
url_query.addQueryItem("cb", redirect_url.toString());
url.setQuery(url_query);
- bool result = QDesktopServices::openUrl(url);
- if (!result) {
- QMessageBox box(QMessageBox::NoIcon, "Scrobbler Authentication", QString("Please open this URL in your browser: %1").arg(url.toString()), QMessageBox::Ok);
- box.setTextFormat(Qt::RichText);
- qLog(Debug) << "Scrobbler authentication URL: " << url.toString();
- box.exec();
+ QMessageBox messagebox(QMessageBox::Information, QString("%1 Scrobbler Authentication").arg(name_), QString("Open URL in web browser?
%1
Press \"Save\" to copy the URL to clipboard and manually open it in a web browser.").arg(url.toString()), QMessageBox::Open|QMessageBox::Save|QMessageBox::Cancel);
+ messagebox.setTextFormat(Qt::RichText);
+ int result = messagebox.exec();
+ switch (result) {
+ case QMessageBox::Open:{
+ bool openurl_result = QDesktopServices::openUrl(url);
+ if (openurl_result) {
+ break;
+ }
+ QMessageBox messagebox_error(QMessageBox::Warning, "Scrobbler Authentication", QString("Could not open URL. Please open this URL in your browser: %1").arg(url.toString()), QMessageBox::Ok);
+ messagebox_error.setTextFormat(Qt::RichText);
+ messagebox_error.exec();
+ }
+ case QMessageBox::Save:
+ QApplication::clipboard()->setText(url.toString());
+ break;
+ case QMessageBox::Cancel:
+ AuthError("Authentication was cancelled.");
+ break;
+ default:
+ break;
}
}
@@ -466,7 +483,7 @@ void ScrobblingAPI20::ScrobbleRequestFinished(QNetworkReply *reply, QListClearSent(list);
return;
}
@@ -612,7 +629,7 @@ void ScrobblingAPI20::SingleScrobbleRequestFinished(QNetworkReply *reply, quint6
int error = json_obj["error"].toInt();
Error(QString("Error: %1: %2").arg(QString::number(error)).arg(error));
}
- Error("Json reply from server is missing session.");
+ Error("Json reply from server is missing scrobbles.");
return;
}