From 9b1b7be207d491690fee9b0aecbadacb76f0367b Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Thu, 7 Jan 2016 00:32:21 +0100 Subject: [PATCH] Fix lastfm infoplugin for usage without account --- .../accounts/lastfm/LastFmInfoPlugin.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp b/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp index 71771ad6b..277a62e17 100644 --- a/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp +++ b/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp @@ -65,13 +65,6 @@ LastFmInfoPlugin::init() return; } - lastfm::ws::ApiKey = "7194b85b6d1f424fe1668173a78c0c4a"; - lastfm::ws::SharedSecret = "ba80f1df6d27ae63e9cb1d33ccf2052f"; - lastfm::ws::Username = m_account.data()->username(); - lastfm::setNetworkAccessManager( Tomahawk::Utils::nam() ); - - m_pw = m_account.data()->password(); - //HACK work around a bug in liblastfm---it doesn't create its config dir, so when it // tries to write the track cache, it fails silently. until we have a fixed version, do this // code taken from Amarok (src/services/lastfm/ScrobblerAdapter.cpp) @@ -86,6 +79,17 @@ LastFmInfoPlugin::init() m_badUrls << QUrl( "http://cdn.last.fm/flatness/catalogue/noimage" ); + + lastfm::ws::ApiKey = "7194b85b6d1f424fe1668173a78c0c4a"; + lastfm::ws::SharedSecret = "ba80f1df6d27ae63e9cb1d33ccf2052f"; + lastfm::setNetworkAccessManager( Tomahawk::Utils::nam() ); + + if ( !m_account.isNull() ) + { + lastfm::ws::Username = m_account->username(); + m_pw = m_account->password(); + } + QTimer::singleShot( 0, this, SLOT( settingsChanged() ) ); }