mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-18 23:09:42 +01:00
Prefer Spotify Webservice over libspotify
This commit is contained in:
parent
631464e20c
commit
fc4dd7ce1c
@ -32,9 +32,9 @@ SpotifyInfoPlugin::SpotifyInfoPlugin( Accounts::SpotifyAccount* account )
|
||||
: InfoPlugin()
|
||||
, m_account( QPointer< Accounts::SpotifyAccount >( account ) )
|
||||
{
|
||||
m_supportedGetTypes << InfoAlbumSongs;
|
||||
if ( !m_account.isNull() )
|
||||
{
|
||||
m_supportedGetTypes << InfoAlbumSongs;
|
||||
m_supportedPushTypes << InfoLove << InfoUnLove;
|
||||
}
|
||||
}
|
||||
@ -138,29 +138,12 @@ SpotifyInfoPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requ
|
||||
const QString album = criteria[ "album" ];
|
||||
const QString artist = criteria[ "artist" ];
|
||||
|
||||
if ( m_account.isNull() || !m_account.data()->loggedIn() )
|
||||
{
|
||||
// No running spotify account, use our webservice
|
||||
QUrl lookupUrl( "http://ws.spotify.com/search/1/album.json" );
|
||||
TomahawkUtils::urlAddQueryItem( lookupUrl, "q", QString( "%1 %2" ).arg( artist ).arg( album ) );
|
||||
// Use always Spotify webservice, faster and more stable
|
||||
QUrl lookupUrl( "http://ws.spotify.com/search/1/album.json" );
|
||||
TomahawkUtils::urlAddQueryItem( lookupUrl, "q", QString( "%1 %2" ).arg( artist ).arg( album ) );
|
||||
|
||||
QNetworkReply * reply = Tomahawk::Utils::nam()->get( QNetworkRequest( lookupUrl ) );
|
||||
NewClosure( reply, SIGNAL( finished() ), this, SLOT( albumIdLookupFinished( QNetworkReply*, Tomahawk::InfoSystem::InfoRequestData ) ), reply, requestData );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Running resolver, so do the lookup through that
|
||||
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Doing album lookup through spotify:" << album << artist;
|
||||
QVariantMap message;
|
||||
message[ "_msgtype" ] = "albumListing";
|
||||
message[ "artist" ] = artist;
|
||||
message[ "album" ] = album;
|
||||
|
||||
QMetaObject::invokeMethod( m_account.data(), "sendMessage", Qt::QueuedConnection, Q_ARG( QVariantMap, message ),
|
||||
Q_ARG( QObject*, this ),
|
||||
Q_ARG( QString, "albumListingResult" ),
|
||||
Q_ARG( QVariant, QVariant::fromValue< InfoRequestData >( requestData ) ) );
|
||||
}
|
||||
QNetworkReply * reply = Tomahawk::Utils::nam()->get( QNetworkRequest( lookupUrl ) );
|
||||
NewClosure( reply, SIGNAL( finished() ), this, SLOT( albumIdLookupFinished( QNetworkReply*, Tomahawk::InfoSystem::InfoRequestData ) ), reply, requestData );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user