mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
* Echonest supporting new API call for biographies.
This commit is contained in:
@@ -38,7 +38,7 @@ EchonestPlugin::EchonestPlugin()
|
|||||||
: InfoPlugin()
|
: InfoPlugin()
|
||||||
{
|
{
|
||||||
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::InfoArtistFamiliarity << Tomahawk::InfoSystem::InfoArtistHotttness << Tomahawk::InfoSystem::InfoArtistTerms << Tomahawk::InfoSystem::InfoMiscTopTerms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -102,10 +102,17 @@ EchonestPlugin::getSongProfile( const Tomahawk::InfoSystem::InfoRequestData &req
|
|||||||
void
|
void
|
||||||
EchonestPlugin::getArtistBiography( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
EchonestPlugin::getArtistBiography( const Tomahawk::InfoSystem::InfoRequestData &requestData )
|
||||||
{
|
{
|
||||||
if( !isValidArtistData( requestData ) )
|
if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
InfoStringHash hash = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash >();
|
||||||
|
if ( !hash.contains( "artist" ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Echonest::Artist artist( requestData.input.toString() );
|
Echonest::Artist artist( hash["artist"] );
|
||||||
QNetworkReply *reply = artist.fetchBiographies();
|
QNetworkReply *reply = artist.fetchBiographies();
|
||||||
reply->setProperty( "artist", QVariant::fromValue< Echonest::Artist >( artist ) );
|
reply->setProperty( "artist", QVariant::fromValue< Echonest::Artist >( artist ) );
|
||||||
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
|
reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
|
||||||
@@ -180,7 +187,6 @@ EchonestPlugin::getArtistBiographySlot()
|
|||||||
siteData[ "text" ] = biography.text();
|
siteData[ "text" ] = biography.text();
|
||||||
siteData[ "attribution" ] = biography.license().attribution;
|
siteData[ "attribution" ] = biography.license().attribution;
|
||||||
siteData[ "licensetype" ] = biography.license().type;
|
siteData[ "licensetype" ] = biography.license().type;
|
||||||
siteData[ "attribution" ] = biography.license().url.toString();
|
|
||||||
biographyMap[ biography.site() ] = siteData;
|
biographyMap[ biography.site() ] = siteData;
|
||||||
}
|
}
|
||||||
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
|
Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >();
|
||||||
@@ -307,4 +313,4 @@ EchonestPlugin::artistFromReply( QNetworkReply* reply )
|
|||||||
|
|
||||||
} //ns Tomahawk
|
} //ns Tomahawk
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2( Tomahawk::InfoSystem::InfoPlugin, Tomahawk::InfoSystem::EchonestPlugin )
|
Q_EXPORT_PLUGIN2( Tomahawk::InfoSystem::InfoPlugin, Tomahawk::InfoSystem::EchonestPlugin )
|
||||||
|
Reference in New Issue
Block a user