[Slim-Checkins] r33960 - /7.7/trunk/server/Slim/Plugin/Slacker/ProtocolHandler.pm

[email protected] Tue, 08 May 2012 11:57:30 -0000
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: mherger
Date: Tue May  8 04:57:29 2012
New Revision: 33960

URL: http://svn.slimdevices.com/slim?rev=33960&view=rev
Log:
Bug: n/a
Description: some features allow skipping back (rew)

Modified:
    7.7/trunk/server/Slim/Plugin/Slacker/ProtocolHandler.pm

Modified: 7.7/trunk/server/Slim/Plugin/Slacker/ProtocolHandler.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Plugin/Slacker/ProtocolHandler.pm?rev=33960&r1=33959&r2=33960&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Plugin/Slacker/ProtocolHandler.pm (original)
+++ 7.7/trunk/server/Slim/Plugin/Slacker/ProtocolHandler.pm Tue May  8 04:57:29 2012
@@ -371,6 +371,12 @@
 	}
 	
 	return 1;
+}
+
+sub canRew {
+	my ( $class, $url ) = @_;
+	
+	return $url =~ m{^slacker://(?:pid|songid|tid)/([^.]+)\.mp3} ? 1 : 0;
 }
 
 # Disallow skips after the limit is reached
@@ -401,7 +407,7 @@
 	}
 	
 	if ( $action eq 'rew' ) {
-		return 0;
+		return $class->canRew($url);
 	}
 	
 	return 1;
@@ -687,14 +693,14 @@
 			duration    => $track->{tlen},
 			replay_gain => $track->{audiogain},
 			# Note Slacker offers 5 image sizes: 75, 272, 383, 700, 1400
-			cover       => 'http://images.slacker.com/covers/272/' . $track->{albumid},
+			cover       => $track->{cover} || 'http://images.slacker.com/covers/1400/' . $track->{albumid},
 			icon        => $icon,
 			bitrate     => '128k CBR',
 			type        => 'MP3 (Slacker)',
 			info_link   => 'plugins/slacker/trackinfo.html',
 			buttons     => {
 				# disable REW/Previous button
-				rew => 0,
+				rew => $class->canRew($url) || 0,
 				# disable FWD when you've reached skip limit
 				fwd => canSkip($client) ? 1 : 0,