[Amarok] Scanner now also looks for "folder.*" as cover ima

Dan Meltzer parallelgrapefruit at gmail.com
Fri Jan 22 15:11:59 CET 2010


On Fri, Jan 22, 2010 at 4:24 AM, Mark Kretschmann <kretschmann at kde.org> wrote:
> commit 4e6ec8fa396e4fcebd35890ddb04336b6ae50b8c
> Author:     Mark Kretschmann <kretschmann at kde.org>
> AuthorDate: Fri Jan 22 10:20:36 2010 +0100
> Commit:     Mark Kretschmann <kretschmann at kde.org>
> CommitDate: Fri Jan 22 10:20:36 2010 +0100
>
>    Scanner now also looks for "folder.*" as cover image.
>
>    Apparently some applications use this convention.
>    @see: http://forum.kde.org/viewtopic.php?f=121&t=85313
>
>    Jeff, could you check if I did this correctly? Thanks.

I realize you just copied the format that was there, but is there any
reason this isn't all in the same loop? constructing QFileInfo's is
relatively expensive, especially in bulk like we are doing here.

More to the point, isn't amarokcollectionscanner supposed to spit out
image paths?  It's already reading everything in the filesystem, so it
would make sense for it to parse cover.blah's at the same point.
>
> diff --git a/ChangeLog b/ChangeLog
> index 22459cf..c90d4f8 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -5,6 +5,8 @@ Amarok ChangeLog
>
>  VERSION 2.2.3
>   FEATURES:
> +    * The collection scanner now also looks for cover images named
> +     "folder.*". Apparently some applications use this convention.
>     * It's now possible to automatically use a USB Mass Storage device as a collection
>       when it's connected.
>     * The progress bar tooltip now shows the position in the track that the
> diff --git a/src/collection/sqlcollection/ScanResultProcessor.cpp b/src/collection/sqlcollection/ScanResultProcessor.cpp
> index a502367..2bba495 100644
> --- a/src/collection/sqlcollection/ScanResultProcessor.cpp
> +++ b/src/collection/sqlcollection/ScanResultProcessor.cpp
> @@ -207,6 +207,18 @@ ScanResultProcessor::findBestImagePath( const QList<QString> &paths )
>     if( !cover.isEmpty() )
>         return cover;
>
> +    //next: try "folder" (some applications apparently use this)
> +    QString folder;
> +    foreach( const QString &path, paths )
> +    {
> +        QString file = QFileInfo( path ).fileName();
> +        if( file.contains( "folder", Qt::CaseInsensitive ) ||
> +                file.contains( i18nc( "folder", "(Front) Cover of an album" ), Qt::CaseInsensitive ) )
> +            folder = path;
> +    }
> +    if( !folder.isEmpty() )
> +        return folder;
> +
>     //last: try "large"
>     QString large;
>     foreach( const QString &path, paths )
>
>
>


More information about the Amarok-devel mailing list