1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 22:26:32 +02:00

Have lastfmplugin use the proper nam(), and same for echonest...echonest was only being given the nam for the gui thread

This commit is contained in:
Jeff Mitchell
2011-11-08 10:39:37 -05:00
parent 8d695c5091
commit 1fc3c4c2f2
2 changed files with 8 additions and 7 deletions

View File

@@ -35,6 +35,7 @@ EchoNestPlugin::EchoNestPlugin()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
m_supportedGetTypes << Tomahawk::InfoSystem::InfoArtistBiography << Tomahawk::InfoSystem::InfoArtistFamiliarity << Tomahawk::InfoSystem::InfoArtistHotttness << Tomahawk::InfoSystem::InfoArtistTerms << Tomahawk::InfoSystem::InfoMiscTopTerms; m_supportedGetTypes << Tomahawk::InfoSystem::InfoArtistBiography << Tomahawk::InfoSystem::InfoArtistFamiliarity << Tomahawk::InfoSystem::InfoArtistHotttness << Tomahawk::InfoSystem::InfoArtistTerms << Tomahawk::InfoSystem::InfoMiscTopTerms;
Echonest::Config::instance()->setNetworkAccessManager( TomahawkUtils::nam() );
} }

View File

@@ -366,7 +366,7 @@ LastFmPlugin::fetchArtistImages( Tomahawk::InfoSystem::InfoRequestData requestDa
void void
LastFmPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData ) LastFmPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
{ {
if ( !lastfm::nam() ) if ( !TomahawkUtils::nam() )
{ {
tLog() << "Have a null QNAM, uh oh"; tLog() << "Have a null QNAM, uh oh";
emit info( requestData, QVariant() ); emit info( requestData, QVariant() );
@@ -470,7 +470,7 @@ LastFmPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSy
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b"; QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b";
QNetworkRequest req( imgurl.arg( artistName ).arg( albumName ) ); QNetworkRequest req( imgurl.arg( artistName ).arg( albumName ) );
QNetworkReply* reply = lastfm::nam()->get( req ); QNetworkReply* reply = TomahawkUtils::nam()->get( req );
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) ); reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
connect( reply, SIGNAL( finished() ), SLOT( coverArtReturned() ) ); connect( reply, SIGNAL( finished() ), SLOT( coverArtReturned() ) );
@@ -483,7 +483,7 @@ LastFmPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSy
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=artist.imageredirect&artist=%1&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b"; QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=artist.imageredirect&artist=%1&autocorrect=1&size=large&api_key=7a90f6672a04b809ee309af169f34b8b";
QNetworkRequest req( imgurl.arg( artistName ) ); QNetworkRequest req( imgurl.arg( artistName ) );
QNetworkReply* reply = lastfm::nam()->get( req ); QNetworkReply* reply = TomahawkUtils::nam()->get( req );
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) ); reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
connect( reply, SIGNAL( finished() ), SLOT( artistImagesReturned() ) ); connect( reply, SIGNAL( finished() ), SLOT( artistImagesReturned() ) );
@@ -631,7 +631,7 @@ LastFmPlugin::coverArtReturned()
} }
else else
{ {
if ( !lastfm::nam() ) if ( !TomahawkUtils::nam() )
{ {
tLog() << Q_FUNC_INFO << "Uh oh, nam is null"; tLog() << Q_FUNC_INFO << "Uh oh, nam is null";
emit info( reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(), QVariant() ); emit info( reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(), QVariant() );
@@ -639,7 +639,7 @@ LastFmPlugin::coverArtReturned()
} }
// Follow HTTP redirect // Follow HTTP redirect
QNetworkRequest req( redir ); QNetworkRequest req( redir );
QNetworkReply* newReply = lastfm::nam()->get( req ); QNetworkReply* newReply = TomahawkUtils::nam()->get( req );
newReply->setProperty( "requestData", reply->property( "requestData" ) ); newReply->setProperty( "requestData", reply->property( "requestData" ) );
connect( newReply, SIGNAL( finished() ), SLOT( coverArtReturned() ) ); connect( newReply, SIGNAL( finished() ), SLOT( coverArtReturned() ) );
} }
@@ -682,7 +682,7 @@ LastFmPlugin::artistImagesReturned()
} }
else else
{ {
if ( !lastfm::nam() ) if ( !TomahawkUtils::nam() )
{ {
tLog() << Q_FUNC_INFO << "Uh oh, nam is null"; tLog() << Q_FUNC_INFO << "Uh oh, nam is null";
emit info( reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(), QVariant() ); emit info( reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(), QVariant() );
@@ -690,7 +690,7 @@ LastFmPlugin::artistImagesReturned()
} }
// Follow HTTP redirect // Follow HTTP redirect
QNetworkRequest req( redir ); QNetworkRequest req( redir );
QNetworkReply* newReply = lastfm::nam()->get( req ); QNetworkReply* newReply = TomahawkUtils::nam()->get( req );
newReply->setProperty( "requestData", reply->property( "requestData" ) ); newReply->setProperty( "requestData", reply->property( "requestData" ) );
connect( newReply, SIGNAL( finished() ), SLOT( artistImagesReturned() ) ); connect( newReply, SIGNAL( finished() ), SLOT( artistImagesReturned() ) );
} }