From kde-commits Tue Nov 30 21:35:58 2010 From: "Rick W.Chen" Date: Tue, 30 Nov 2010 21:35:58 +0000 To: kde-commits Subject: [Amarok] bdea04b: Suppress cover fetch when committing track data ch Message-Id: <20101130213558.6AF6DA60B0 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=129115301429376 commit bdea04b3a924b3ab3de430d6301b804d03ead799 branch master Author: Rick W. Chen Date: Wed Dec 1 06:51:05 2010 +1300 Suppress cover fetch when committing track data changes diff --git a/src/core-impl/collections/db/sql/SqlMeta.cpp b/src/core-impl/collections/db/sql/SqlMeta.cpp index a53e2f2..967b742 100644 --- a/src/core-impl/collections/db/sql/SqlMeta.cpp +++ b/src/core-impl/collections/db/sql/SqlMeta.cpp @@ -883,12 +883,21 @@ SqlTrack::commitMetaDataChanges() // if the current album is no compilation and we aren't changing // the album anyway, then we need to create a new album with the // new artist. - if( m_album && - m_album->hasAlbumArtist() && - m_album->albumArtist() == oldArtist && - !m_cache.contains( Meta::valAlbum ) && - !m_cache.contains( Meta::valAlbumId ) ) - m_cache.insert( Meta::valAlbum, m_album->name() ); + if( m_album ) + { + bool supp = m_album->suppressImageAutoFetch(); + m_album->setSuppressImageAutoFetch( true ); + + if( m_album->hasAlbumArtist() && + m_album->albumArtist() == oldArtist && + !m_cache.contains( Meta::valAlbum ) && + !m_cache.contains( Meta::valAlbumId ) ) + { + m_cache.insert( Meta::valAlbum, m_album->name() ); + } + + m_album->setSuppressImageAutoFetch( supp ); + } collectionChanged = true; } @@ -1010,9 +1019,19 @@ SqlTrack::commitMetaDataChanges() m_lock.unlock(); // or else we provoke a deadlock // copy the image BUG: 203211 (we need to do it here or provoke a dead lock) - if( oldAlbum && newAlbum && - oldAlbum->hasImage() && !newAlbum->hasImage() ) - newAlbum->setImage( oldAlbum->imageLocation().path() ); + if( oldAlbum && newAlbum ) + { + bool oldSupp = oldAlbum->suppressImageAutoFetch(); + bool newSupp = newAlbum->suppressImageAutoFetch(); + oldAlbum->setSuppressImageAutoFetch( true ); + newAlbum->setSuppressImageAutoFetch( true ); + + if( oldAlbum->hasImage() && !newAlbum->hasImage() ) + newAlbum->setImage( oldAlbum->imageLocation().path() ); + + oldAlbum->setSuppressImageAutoFetch( oldSupp ); + newAlbum->setSuppressImageAutoFetch( newSupp ); + } registry->commitDirtyTracks(); m_lock.lockForWrite();