1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-24 01:39:42 +01:00

* Make sure we always have a working uuid in Artist / Album.

This commit is contained in:
Christian Muehlhaeuser 2012-05-28 16:32:29 +02:00
parent c8afb7a7c6
commit 3b04498661
4 changed files with 30 additions and 15 deletions

View File

@ -115,14 +115,12 @@ Album::cover( const QSize& size, bool forceLoad ) const
if ( !forceLoad )
return QPixmap();
m_uuid = uuid();
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["artist"] = artist()->name();
trackInfo["album"] = name();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = m_uuid;
requestData.caller = infoid();
requestData.type = Tomahawk::InfoSystem::InfoAlbumCoverArt;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
@ -170,7 +168,7 @@ Album::cover( const QSize& size, bool forceLoad ) const
void
Album::infoSystemInfo( const Tomahawk::InfoSystem::InfoRequestData& requestData, const QVariant& output )
{
if ( requestData.caller != m_uuid ||
if ( requestData.caller != infoid() ||
requestData.type != Tomahawk::InfoSystem::InfoAlbumCoverArt )
{
return;
@ -193,7 +191,7 @@ Album::infoSystemInfo( const Tomahawk::InfoSystem::InfoRequestData& requestData,
void
Album::infoSystemFinished( const QString& target )
{
if ( target != m_uuid )
if ( target != infoid() )
return;
disconnect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
@ -230,3 +228,13 @@ Album::tracks( ModelMode mode, const Tomahawk::collection_ptr& collection )
{
return playlistInterface( mode, collection )->tracks();
}
QString
Album::infoid() const
{
if ( m_uuid.isEmpty() )
m_uuid = uuid();
return m_uuid;
}

View File

@ -77,6 +77,7 @@ private slots:
private:
Q_DISABLE_COPY( Album )
QString infoid() const;
unsigned int m_id;
QString m_name;

View File

@ -111,9 +111,6 @@ Artist::albums( ModelMode mode, const Tomahawk::collection_ptr& collection ) con
if ( !collection.isNull() )
dbLoaded = false;
m_uuid = uuid();
tDebug() << Q_FUNC_INFO << mode;
if ( ( mode == DatabaseMode || mode == Mixed ) && !dbLoaded )
{
DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( collection, artist );
@ -131,7 +128,7 @@ Artist::albums( ModelMode mode, const Tomahawk::collection_ptr& collection ) con
artistInfo["artist"] = name();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = m_uuid;
requestData.caller = infoid();
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
requestData.type = Tomahawk::InfoSystem::InfoArtistReleases;
@ -171,7 +168,7 @@ Artist::similarArtists() const
artistInfo["artist"] = name();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = m_uuid;
requestData.caller = infoid();
requestData.customData = QVariantMap();
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
@ -259,7 +256,7 @@ Artist::onAlbumsFound( const QList< album_ptr >& albums, const QVariant& data )
void
Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{
if ( requestData.caller != m_uuid )
if ( requestData.caller != infoid() )
return;
QVariantMap returnedData = output.value< QVariantMap >();
@ -274,7 +271,6 @@ Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVari
QList< album_ptr > albums;
foreach ( const QString& albumName, albumNames )
{
tDebug() << Q_FUNC_INFO << albumName;
Tomahawk::album_ptr album = Tomahawk::Album::get( m_ownRef.toStrongRef(), albumName, false );
m_officialAlbums << album;
albums << album;
@ -328,7 +324,7 @@ Artist::infoSystemFinished( QString target )
{
Q_UNUSED( target );
if ( target != m_uuid )
if ( target != infoid() )
return;
if ( --m_infoJobs == 0 )
@ -352,13 +348,12 @@ Artist::cover( const QSize& size, bool forceLoad ) const
{
if ( !forceLoad )
return QPixmap();
m_uuid = uuid();
Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["artist"] = name();
Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = m_uuid;
requestData.caller = infoid();
requestData.type = Tomahawk::InfoSystem::InfoArtistImages;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
requestData.customData = QVariantMap();
@ -428,3 +423,13 @@ Artist::tracks( ModelMode mode, const Tomahawk::collection_ptr& collection )
{
return playlistInterface( mode, collection )->tracks();
}
QString
Artist::infoid() const
{
if ( m_uuid.isEmpty() )
m_uuid = uuid();
return m_uuid;
}

View File

@ -88,6 +88,7 @@ private slots:
private:
Artist();
QString infoid() const;
unsigned int m_id;
QString m_name;