[Slim-Checkins] r15314 - /trunk/server/Slim/Web/Graphics.pm

andy at svn.slimdevices.com andy at svn.slimdevices.com
Fri Dec 14 11:49:34 PST 2007


Author: andy
Date: Fri Dec 14 11:49:34 2007
New Revision: 15314

URL: http://svn.slimdevices.com?rev=15314&view=rev
Log:
Fix bug in cached artwork logic

Modified:
    trunk/server/Slim/Web/Graphics.pm

Modified: trunk/server/Slim/Web/Graphics.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Graphics.pm?rev=15314&r1=15313&r2=15314&view=diff
==============================================================================
--- trunk/server/Slim/Web/Graphics.pm (original)
+++ trunk/server/Slim/Web/Graphics.pm Fri Dec 14 11:49:34 2007
@@ -144,25 +144,25 @@
 		
 		$log->info("  artwork cache key: $cacheKey");
 		
-		$cachedImage = $cache->get($cacheKey);
-		
-		my $artworkFile = $cachedImage->{'orig'};
-		
-		if ( $cachedImage && defined $artworkFile ) {
-			# Check mtime of original artwork has not changed
-			if ( $artworkFile && -r $artworkFile ) {
-				my $origMtime = (stat _)[9];
-				if ( $cachedImage->{'mtime'} != $origMtime ) {
-					$log->info( "  artwork mtime $origMtime differs from cached mtime " . $cachedImage->{'mtime'} );
-					$cachedImage = undef;
+		if ( $cachedImage = $cache->get($cacheKey) ) {
+			my $artworkFile = $cachedImage->{'orig'};
+		
+			if ( defined $artworkFile ) {
+				# Check mtime of original artwork has not changed
+				if ( $artworkFile && -r $artworkFile ) {
+					my $origMtime = (stat _)[9];
+					if ( $cachedImage->{'mtime'} != $origMtime ) {
+						$log->info( "  artwork mtime $origMtime differs from cached mtime " . $cachedImage->{'mtime'} );
+						$cachedImage = undef;
+					}
 				}
-			}
-		
-			if ( $cachedImage ) {
-
-				$log->info("  returning cached artwork image.");
-
-				return ($cachedImage->{'body'}, $cachedImage->{'mtime'}, $inode, $cachedImage->{'size'}, $cachedImage->{'contentType'});
+		
+				if ( $cachedImage ) {
+
+					$log->info("  returning cached artwork image.");
+
+					return ($cachedImage->{'body'}, $cachedImage->{'mtime'}, $inode, $cachedImage->{'size'}, $cachedImage->{'contentType'});
+				}
 			}
 		}
 	}



More information about the checkins mailing list