[Slim-Checkins] r12726 - in /trunk/server/Slim: Control/Commands.pm Control/Queries.pm Player/Player.pm

adrian at svn.slimdevices.com adrian at svn.slimdevices.com
Fri Aug 24 15:29:15 PDT 2007


Author: adrian
Date: Fri Aug 24 15:29:15 2007
New Revision: 12726

URL: http://svn.slimdevices.com?rev=12726&view=rev
Log:
Bug: N/A
Description: fix filtering of showbriefly's sent to jive
(request->source changed), change display hash entry for json to 'jive'

Modified:
    trunk/server/Slim/Control/Commands.pm
    trunk/server/Slim/Control/Queries.pm
    trunk/server/Slim/Player/Player.pm

Modified: trunk/server/Slim/Control/Commands.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Control/Commands.pm?rev=12726&r1=12725&r2=12726&view=diff
==============================================================================
--- trunk/server/Slim/Control/Commands.pm (original)
+++ trunk/server/Slim/Control/Commands.pm Fri Aug 24 15:29:15 2007
@@ -509,7 +509,7 @@
 
 	# FIXME - make this conditional on client being jive?
 	$client->showBriefly({
-		'jiv' => { 
+		'jive' => { 
 			'type'    => 'song',
 			'text'    => [ Slim::Utils::Strings::string('JIVE_POPUP_REMOVING'),
 						   $song->title,
@@ -1092,7 +1092,7 @@
 
 				$client->showBriefly({
 					'line' => [$line1, $line2],
-					'jiv'  => { 'type' => 'song', text => [ $line2 ], 'icon-id' => 0 },
+					'jive' => { 'type' => 'song', text => [ $line2 ], 'icon-id' => 0 },
 				}, { 'duration' => $timeout + 5 });
 			}
 		}
@@ -1485,7 +1485,7 @@
 
 		if ($load || $add) {
 			$client->showBriefly({ 
-				'jiv' => { 
+				'jive' => { 
 					'type'    => 'song',
 					'text'    => $add
 						? [ Slim::Utils::Strings::string('JIVE_POPUP_ADDING'), $tracks[0]->title,

Modified: trunk/server/Slim/Control/Queries.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Control/Queries.pm?rev=12726&r1=12725&r2=12726&view=diff
==============================================================================
--- trunk/server/Slim/Control/Queries.pm (original)
+++ trunk/server/Slim/Control/Queries.pm Fri Aug 24 15:29:15 2007
@@ -723,20 +723,20 @@
 	my $type  = $request->getParam('_type');
 	my $parts = $request->getParam('_parts');
 
-	# check displaynotify type against subscription ('showbriefly', 'update' or 'all')
+	# check displaynotify type against subscription ('showbriefly', 'update', 'bits', 'all')
 	if ($subs eq $type || $subs eq 'all' || $subs eq 'bits') {
 
+		my $pd = $self->privateData;
+
 		# display forwarding is suppressed for this subscriber source
-		return 0 if exists $parts->{ lc $self->source } && !$parts->{ lc $self->source };
+		return 0 if exists $parts->{ $pd->{'format'} } && !$parts->{ $pd->{'format'} };
 
 		# don't send updates if there is no change
 		return 0 if ($type eq 'update' && !$self->client->display->renderCache->{'screen1'}->{'changed'});
 
-		# store display info in request so it can be accessed later
-		$self->privateData({
-			'type'     => $type,
-			'parts'    => $parts,
-		});
+		# store display info in subscription request so it can be accessed by displaystatusQuery
+		$pd->{'type'}  = $type;
+		$pd->{'parts'} = $parts;
 
 		# execute the query immediately
 		$self->__autoexecute;
@@ -762,7 +762,7 @@
 	if (my $pd = $request->privateData) {
 
 		my $client= $request->client;
-		my $source= $request->source;
+		my $format= $pd->{'format'};
 		my $type  = $pd->{'type'};
 		my $parts = $type eq 'showbriefly' ? $pd->{'parts'} : $client->display->renderCache;
 
@@ -784,7 +784,7 @@
 			$request->addResult('bits', MIME::Base64::encode_base64($bits) );
 			$request->addResult('ext', $parts->{'extent'});
 
-		} elsif ($source eq 'CLI') {
+		} elsif ($format eq 'cli') {
 
 			# format display for cli
 			for my $c (keys %$parts) {
@@ -794,35 +794,30 @@
 				}
 			}
 
-		} elsif ( $source =~ m{^(?:JSONRPC|/)} ) { # Return this for JSONRPC or Cometd requests (start with /)
+		} elsif ($format eq 'jive') {
 
 			# send display to jive from one of the following components
-			if (my $ref = $parts->{'jiv'} && ref $parts->{'jiv'}) {
+			if (my $ref = $parts->{'jive'} && ref $parts->{'jive'}) {
 				if ($ref eq 'CODE') {
-					$request->addResult('display', $parts->{'jiv'}->() );
+					$request->addResult('display', $parts->{'jive'}->() );
 				} elsif($ref eq 'ARRAY') {
-					$request->addResult('display', { 'text' => $parts->{'jiv'} });
+					$request->addResult('display', { 'text' => $parts->{'jive'} });
 				} else {
-					$request->addResult('display', $parts->{'jiv'} );
+					$request->addResult('display', $parts->{'jive'} );
 				}
 			} else {
 				$request->addResult('display', { 'text' => $parts->{'line'} || $parts->{'center'} });
 			}
 		}
-			
-		$request->privateData({});
-
-	} else {
-
-		# no private data this must be the first query - check for subscription management
-		if ($subs && $subs ne '-') {
-			$request->registerAutoExecute(0, \&displaystatusQuery_filter);
-			if ($subs ne 'showbriefly') {
-				$request->client->display->resetDisplay;
-				$request->client->update;
-			}
-		} else {
-			$request->registerAutoExecute('-');
+
+	} elsif ($subs =~ /showbriefly|update|bits|all/) {
+		# new subscription request - add subscription, assume cli or jive format for the moment
+		$request->privateData({ 'format' => $request->source eq 'CLI' ? 'cli' : 'jive' }); 
+		$request->registerAutoExecute(0, \&displaystatusQuery_filter);
+
+		if ($subs ne 'showbriefly') {
+			$request->client->display->resetDisplay;
+			$request->client->update;
 		}
 	}
 		

Modified: trunk/server/Slim/Player/Player.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Player/Player.pm?rev=12726&r1=12725&r2=12726&view=diff
==============================================================================
--- trunk/server/Slim/Player/Player.pm (original)
+++ trunk/server/Slim/Player/Player.pm Fri Aug 24 15:29:15 2007
@@ -241,7 +241,7 @@
 					'text'           => 2,
 				},
 			'screen2' => {},
-			'jiv' => undef,
+			'jive' => undef,
 		}, undef, undef, 1);
 
 		# check if there is a sync group to restore
@@ -492,7 +492,7 @@
 			};
 		}
 
-		$parts->{'jiv'} = {
+		$parts->{'jive'} = {
 			'type'    => 'song',
 			'text'    => [ $status, $song->title ],
 			'icon-id' => $song->remote ? 0 : $song->album->artwork || 0,
@@ -686,7 +686,7 @@
 	});
 
 	# suppress display forwarding
-	$parts->{'jiv'} = $parts->{'cli'} = undef;
+	$parts->{'jive'} = $parts->{'cli'} = undef;
 
 	$client->display->showBriefly($parts, { 'name' => 'mixer' } );
 



More information about the checkins mailing list