diff -urN Slim.orig/Music/Artwork.pm Slim/Music/Artwork.pm --- Slim.orig/Music/Artwork.pm 2008-05-15 12:53:58.000000000 +1000 +++ Slim/Music/Artwork.pm 2008-06-11 21:59:59.000000000 +1000 @@ -273,14 +273,22 @@ # to generate that pattern. This is nasty. if (defined($artwork) && $artwork =~ /^%(.*?)(\..*?){0,1}$/) { - my $suffix = $2 ? $2 : ".jpg"; + my @customnames; + my $pattern = $1; - if (my $prefix = Slim::Music::TitleFormatter::infoFormat( - Slim::Utils::Misc::fileURLFromPath($track->url), $1)) { - - $artwork = $prefix . $suffix; - - $log->info("Variable cover: $artwork from $1"); + if ($2) { + @customnames = [ Slim::Music::TitleFormatter::infoFormat( + Slim::Utils::Misc::fileURLFromPath($track->url), + $pattern) . $2 ]; + } else { + my $format = Slim::Music::TitleFormatter::infoFormat( + Slim::Utils::Misc::fileURLFromPath($track->url), $pattern); + @customnames = map { "$format.$_" } @ext; + } + + foreach my $artwork (@customnames) { + + $log->info("Variable cover: $artwork from $pattern"); if (Slim::Utils::OSDetect::OS() eq 'win') { # Remove illegal characters from filename. @@ -306,11 +314,10 @@ return ($body, $contentType, $artPath); } - } else { - - $log->info("Variable cover: no match from $1"); } + $log->info("Variable cover: no match from $1"); + } elsif (defined $artwork) { unshift @filestotry, $artwork; Binary files Slim.orig/Music/.Artwork.pm.swp and Slim/Music/.Artwork.pm.swp differ