[Slim-Checkins] r12676 - in /trunk/server/Slim/Plugin/Pandora: Plugin.pm ProtocolHandler.pm

andy at svn.slimdevices.com andy at svn.slimdevices.com
Wed Aug 22 15:05:48 PDT 2007


Author: andy
Date: Wed Aug 22 15:05:47 2007
New Revision: 12676

URL: http://svn.slimdevices.com?rev=12676&view=rev
Log:
Few fixes to Pandora plugin

Modified:
    trunk/server/Slim/Plugin/Pandora/Plugin.pm
    trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm

Modified: trunk/server/Slim/Plugin/Pandora/Plugin.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/Pandora/Plugin.pm?rev=12676&r1=12675&r2=12676&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/Pandora/Plugin.pm (original)
+++ trunk/server/Slim/Plugin/Pandora/Plugin.pm Wed Aug 22 15:05:47 2007
@@ -81,7 +81,9 @@
 		
 	$log->debug("Pandora: Skip requested");
 	
-	# XXX: figure out how to avoid buffering display
+	# Tell onJump not to display buffering info, so we don't
+	# mess up the showBriefly message
+	$client->pluginData( banMode => 1 );
 	
 	$client->execute(["playlist", "jump", "+1"]);
 }

Modified: trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm?rev=12676&r1=12675&r2=12676&view=diff
==============================================================================
--- trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm (original)
+++ trunk/server/Slim/Plugin/Pandora/ProtocolHandler.pm Wed Aug 22 15:05:47 2007
@@ -209,7 +209,14 @@
     my ( $class, $client, $nextURL, $callback ) = @_;
 
 	# Display buffering info on loading the next track
-	$client->pluginData( showBuffering => 1 );
+	# unless we shouldn't (when rating down)
+	if ( $client->pluginData('banMode') ) {
+		$client->pluginData( showBuffering => 0 );
+		$client->pluginData( banMode => 0 );
+	}
+	else {
+		$client->pluginData( showBuffering => 1 );
+	}
 	
 	# Get next track
 	my ($stationId) = $nextURL =~ m{^pandora://([^.]+)\.mp3};
@@ -261,6 +268,25 @@
 		block  => 1,
 		scroll => 1,
 	} );
+	
+	# Report the audio failure to Pandora
+	my ($stationId)  = $url =~ m{^pandora://([^.]+)\.mp3};
+	my $currentTrack = $client->pluginData('prevTrack') || $client->pluginData('currentTrack');
+	
+	my $url = Slim::Networking::SqueezeNetwork->url(
+		  '/api/pandora/opml/playback?audioError?stationId=' . $stationId 
+		. '&trackId=' . $currentTrack->{trackToken}
+	);
+	
+	my $http = Slim::Networking::SqueezeNetwork->new(
+		sub {},
+		sub {},
+		{
+			client => $client,
+		},
+	);
+	
+	$http->get( $url );
 	
 	# XXX: Stop after a certain number of errors in a row
 	
@@ -458,9 +484,9 @@
 }
 
 sub getCurrentTitle {
-    my ( $class, $client, $url ) = @_;
-    
-    return $client->pluginData('currentTitle');
+	my ( $class, $client, $url ) = @_;
+	
+	return $client->pluginData('currentTitle');
 }
 
 1;



More information about the checkins mailing list