[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdeextragear-1/amarok
From:       Seb Ruiz <seb100 () optusnet ! com ! au>
Date:       2005-04-25 7:23:41
Message-ID: 200504251723.41625.seb100 () optusnet ! com ! au
[Download RAW message or body]

This code is bad for two reasons:

a) Cover fetching from directories is broken

b) An image is stored in cache albumcovers/tagcover for everysingle file.  
Lets take the average case, an album will have the same cover for every file 
- a lot of redundancy and wasted space.

Is there a reason for this?

Seb

On Thu, 21 Apr 2005 06:42 pm, Mark Kretschmann wrote:
> CVS commit by markey:
>
> Patch from Christian Loose <christian.loose@hamburg.de>:
>
> Re-enabled support for reading embedded cover images from ID3 tags.
>
> CCBUG: 88492
>
>
>   M +2 -1      ChangeLog   1.617
>   M +9 -19     src/collectiondb.cpp   1.325
>
>
> --- kdeextragear-1/amarok/ChangeLog  #1.616:1.617
> @@ -6,4 +6,5 @@
>  VERSION 1.3-beta1:
>    FEATURES:
> +    * Support for reading embedded images from the ID3 tag. (BR 88492)
>      * Wikipedia tab in ContextBrowser allows for artist biography
> retrieval and more!
> @@ -24,5 +25,5 @@
>
>    CHANGES:
> -    * Add a label (with shortcut) to the Playlist filter
> +    * Add a label (with shortcut) to the Playlist filter.
>
>    BUGFIXES:
>
> --- kdeextragear-1/amarok/src/collectiondb.cpp  #1.324:1.325
> @@ -733,8 +733,4 @@ CollectionDB::findImageByMetabundle( Met
>      Q_UNUSED( width );
>
> -    // Deactived because TagLib (1.3.1) crashes frequently with this stuff
> -
> -    #if 0
> -
>      QCString widthKey = makeWidthKey( width );
>      QCString tagKey = md5sum( trackInformation.url().path(),
> trackInformation.artist() ); //what's more unique than the file name? @@
> -764,19 +760,11 @@ CollectionDB::findImageByMetabundle( Met
>                  debug() << "Size of image: " <<  imgVector.size() << "
> byte" << endl;
>
> -                QByteArray imgData;
> -                const char *tempCString = imgVector.data();
> -
> -                // is there a better way to do this?
> -                imgData.setRawData ( tempCString , imgVector.size() );
> -                QImage image = QImage( imgData );
> -
> -                // if we don't reset, the whole system get's meesed up
> -                imgData.resetRawData ( tempCString , imgVector.size() );
> -                if (! image.isNull() )
> +                QImage image;
> +                if( image.loadFromData((const uchar*)imgVector.data(),
> imgVector.size()) ) {
>                      if ( width > 1 )
>                      {
> -                        image.smoothScale( width, width, QImage::ScaleMin
> ).save( tagCoverDir.filePath( widthKey + tagKey ), "PNG" ); -              
>          return tagCoverDir.filePath( widthKey + tagKey ) ; +              
>          image.smoothScale( width, width, QImage::ScaleMin ).save(
> m_cacheDir.filePath( widthKey + tagKey ), "PNG" ); +                       
> return m_cacheDir.filePath( widthKey + tagKey ); } else
>                      {
> @@ -789,6 +777,4 @@ CollectionDB::findImageByMetabundle( Met
>      } // caching
>
> -    #endif
> -
>      return QString::null;
>  }
> @@ -856,5 +842,9 @@ QString
>  CollectionDB::albumImage( MetaBundle trackInformation, uint width )
>  {
> -    return albumImage( trackInformation.artist(),
> trackInformation.album(), width ); +    QString path =
> findImageByMetabundle( trackInformation, width ); +    if( path.isEmpty() )
> +        path =albumImage( trackInformation.artist(),
> trackInformation.album(), width ); +
> +    return path;
>  }

-- 
Seb is now playing:
	Something for Kate - Feeding the Birds and Hoping for Something :: Echolalia 
(2001)


www.sebruiz.net
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic