Summary: | Cover isn't replaced by amazon search in context browser | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Voggeneder Simon <chaosgeisterchen> |
Component: | Context View | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | uli.2001, xstasi |
Priority: | NOR | ||
Version: | 1.4.1 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Voggeneder Simon
2006-07-09 16:46:05 UTC
oh.. before I forget Kubuntu Dapper 6.06 KDE 3.5.3 from Kubuntu.org amaroK 1.4.1 from Kubuntu.org every other package up to date If it helps :) SVN commit 624268 by tknieper: Embed album covers in html as encoded strings to get around KHtmlView's caching. BUG: 130518 M +1 -0 ChangeLog M +20 -11 src/contextbrowser.cpp M +2 -0 src/contextbrowser.h --- trunk/extragear/multimedia/amarok/ChangeLog #624267:624268 @@ -97,6 +97,7 @@ * Amarok now saves playlists with relative paths by default. BUGFIXES: + * Context browser would not display updated covers correctly. (BR 130518) * The select custom cover dialog no longer starts in the wrong directory for compilations. (BR 131776) * Amarok's xine engine would cut off approximately the last second of an --- trunk/extragear/multimedia/amarok/src/contextbrowser.cpp #624267:624268 @@ -1389,7 +1389,7 @@ QString artistName = albumValues[5].isEmpty() ? i18n( "Unknown artist" ) : albumValues[5]; - QString albumImage = CollectionDB::instance()->albumImage( albumValues[5], reqResult[ i ], true, 50 ); + QString albumImage = ContextBrowser::getEncodedImage( CollectionDB::instance()->albumImage( albumValues[5], reqResult[ i ], true, 50 ) ); QString albumImageTitleAttr = albumImageTooltip( albumImage, 50 ); // Album image @@ -1733,13 +1733,7 @@ const QString titleUrl = lastFmInfo->titleUrl(); const QString lastfmIcon = "file://" + locate( "data","amarok/images/lastfm.png" ); - // Embed cover image in html (encoded string), to get around khtml's caching - const QImage img( lastFmInfo->imageUrl() ); - QByteArray ba; - QBuffer buffer( ba ); - buffer.open( IO_WriteOnly ); - img.save( &buffer, "PNG" ); // writes image into ba in PNG format - const QString coverImage = QString( "data:image/png;base64,%1" ).arg( KCodecs::base64Encode( ba ) ); + const QString coverImage = ContextBrowser::getEncodedImage( lastFmInfo->imageUrl() ); QPtrList<QString> newUrls; newUrls.append( &albumUrl ); @@ -2194,7 +2188,7 @@ usleep( 10000 ); //making 2 tables is most probably not the cleanest way to do it, but it works. - QString albumImage = CollectionDB::instance()->albumImage( currentTrack, true, 1 ); + QString albumImage = ContextBrowser::getEncodedImage( CollectionDB::instance()->albumImage( currentTrack, true, 1 ) ); QString albumImageTitleAttr = albumImageTooltip( albumImage, 0 ); bool isCompilation = false; @@ -2660,7 +2654,7 @@ i_albumLength += QString(albumValues[j + 4]).toInt(); QString albumLength = ( i_albumLength==0 ? i18n( "Unknown" ) : MetaBundle::prettyTime( i_albumLength, true ) ); - QString albumImage = CollectionDB::instance()->albumImage( artist, values[ i ], true, 50 ); + QString albumImage = ContextBrowser::getEncodedImage( CollectionDB::instance()->albumImage( artist, values[ i ], true, 50 ) ); QString albumImageTitleAttr = albumImageTooltip( albumImage, 50 ); m_HTMLSource.append( QStringx ( @@ -2823,7 +2817,7 @@ i_albumLength += QString(albumValues[j + 4]).toInt(); QString albumLength = ( i_albumLength==0 ? i18n( "Unknown" ) : MetaBundle::prettyTime( i_albumLength, true ) ); - QString albumImage = CollectionDB::instance()->albumImage( artist, values[ i ], true, 50 ); + QString albumImage = ContextBrowser::getEncodedImage( CollectionDB::instance()->albumImage( artist, values[ i ], true, 50 ) ); QString albumImageTitleAttr = albumImageTooltip( albumImage, 50 ); m_HTMLSource.append( QStringx ( @@ -3157,6 +3151,21 @@ saveHtmlData(); // Send html code to file } +QString +ContextBrowser::getEncodedImage( const QString &imageUrl ) +{ + // Embed cover image in html (encoded string), to get around khtml's caching + //debug() << "Encoding imageUrl: " << imageUrl << endl; + const QImage img( imageUrl ); + QByteArray ba; + QBuffer buffer( ba ); + buffer.open( IO_WriteOnly ); + img.save( &buffer, "PNG" ); // writes image into ba in PNG format + const QString coverImage = QString( "data:image/png;base64,%1" ).arg( KCodecs::base64Encode( ba ) ); + //debug() << "Encoded imageUrl: " << coverImage << endl; + return coverImage; +} + ////////////////////////////////////////////////////////////////////////////////////////// // Lyrics-Tab ////////////////////////////////////////////////////////////////////////////////////////// --- trunk/extragear/multimedia/amarok/src/contextbrowser.h #624267:624268 @@ -134,6 +134,8 @@ void saveHtmlData(); void showScanning(); + static QString getEncodedImage( const QString &imageUrl ); + static QString wikiLocale(); static void setWikiLocale( const QString &locale ); static QString wikiURL( const QString &item ); *** Bug 114887 has been marked as a duplicate of this bug. *** *** Bug 132538 has been marked as a duplicate of this bug. *** |