1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-10 16:14:40 +02:00

* Use new biography API call in Artist class.

This commit is contained in:
Christian Muehlhaeuser
2012-12-09 06:39:24 +01:00
parent 455e525b11
commit 14676071b9
2 changed files with 12 additions and 9 deletions

View File

@@ -28,6 +28,7 @@
#include "database/IdThreadWorker.h" #include "database/IdThreadWorker.h"
#include "Source.h" #include "Source.h"
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include <QReadWriteLock> #include <QReadWriteLock>
@@ -300,13 +301,14 @@ Artist::biography() const
{ {
if ( !m_biographyLoaded ) if ( !m_biographyLoaded )
{ {
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["artist"] = name();
Tomahawk::InfoSystem::InfoRequestData requestData; Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = infoid(); requestData.caller = infoid();
requestData.customData = QVariantMap();
requestData.input = name();
requestData.type = Tomahawk::InfoSystem::InfoArtistBiography; requestData.type = Tomahawk::InfoSystem::InfoArtistBiography;
requestData.requestId = TomahawkUtils::infosystemRequestId(); requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
connect( Tomahawk::InfoSystem::InfoSystem::instance(), connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
@@ -454,7 +456,6 @@ Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVari
case InfoSystem::InfoArtistBiography: case InfoSystem::InfoArtistBiography:
{ {
QVariantMap bmap = output.toMap(); QVariantMap bmap = output.toMap();
foreach ( const QString& source, bmap.keys() ) foreach ( const QString& source, bmap.keys() )
{ {
if ( source == "last.fm" ) if ( source == "last.fm" )
@@ -530,9 +531,11 @@ Artist::cover( const QSize& size, bool forceLoad ) const
if ( !m_cover && !m_coverBuffer.isEmpty() ) if ( !m_cover && !m_coverBuffer.isEmpty() )
{ {
m_cover = new QPixmap(); QPixmap cover;
m_cover->loadFromData( m_coverBuffer ); cover.loadFromData( m_coverBuffer );
m_coverBuffer.clear(); m_coverBuffer.clear();
m_cover = new QPixmap( TomahawkUtils::squareCenterPixmap( cover ) );
} }
if ( m_cover && !m_cover->isNull() && !size.isEmpty() ) if ( m_cover && !m_cover->isNull() && !size.isEmpty() )