[Slim-Checkins] r12566 - /trunk/server/Slim/Music/Artwork.pm

kdf at svn.slimdevices.com kdf at svn.slimdevices.com
Wed Aug 15 12:38:46 PDT 2007


Author: kdf
Date: Wed Aug 15 12:38:46 2007
New Revision: 12566

URL: http://svn.slimdevices.com?rev=12566&view=rev
Log:
Bug: n/a
Description: bypass artwork file checking for pattern matched art if there is nothing matched from the pattern


Modified:
    trunk/server/Slim/Music/Artwork.pm

Modified: trunk/server/Slim/Music/Artwork.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Music/Artwork.pm?rev=12566&r1=12565&r2=12566&view=diff
==============================================================================
--- trunk/server/Slim/Music/Artwork.pm (original)
+++ trunk/server/Slim/Music/Artwork.pm Wed Aug 15 12:38:46 2007
@@ -248,35 +248,40 @@
 
 		my $suffix = $2 ? $2 : ".jpg";
 
-		$artwork = Slim::Music::TitleFormatter::infoFormat(
-			Slim::Utils::Misc::fileURLFromPath($track->url), $1
-		) . $suffix;
-
-		$log->info("Variable cover: $artwork from $1");
-
-		if (Slim::Utils::OSDetect::OS() eq 'win') {
-			# Remove illegal characters from filename.
-			$artwork =~ s/\\|\/|\:|\*|\?|\"|<|>|\|//g;
-		}
-
-		my $artPath = $parentDir->file($artwork)->stringify;
-
-		my ($body, $contentType) = $class->getImageContentAndType($artPath);
-
-		my $artDir  = dir($prefs->get('artfolder'));
-
-		if (!$body && defined $artDir) {
-
-			$artPath = $artDir->file($artwork)->stringify;
-
-			($body, $contentType) = $class->getImageContentAndType($artPath);
-		}
-
-		if ($body && $contentType) {
-
-			$log->info("Found image file: $artPath");
-
-			return ($body, $contentType, $artPath);
+		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 (Slim::Utils::OSDetect::OS() eq 'win') {
+				# Remove illegal characters from filename.
+				$artwork =~ s/\\|\/|\:|\*|\?|\"|<|>|\|//g;
+			}
+	
+			my $artPath = $parentDir->file($artwork)->stringify;
+	
+			my ($body, $contentType) = $class->getImageContentAndType($artPath);
+	
+			my $artDir  = dir($prefs->get('artfolder'));
+	
+			if (!$body && defined $artDir) {
+	
+				$artPath = $artDir->file($artwork)->stringify;
+	
+				($body, $contentType) = $class->getImageContentAndType($artPath);
+			}
+	
+			if ($body && $contentType) {
+	
+				$log->info("Found image file: $artPath");
+	
+				return ($body, $contentType, $artPath);
+			}
+		} else {
+			
+			$log->info("Variable cover: no match from $1");
 		}
 
 	} elsif (defined $artwork) {



More information about the checkins mailing list