[Slim-Checkins] r33866 - in /7.7/trunk/server/Slim: Control/Queries.pm Control/Request.pm Display/Display.pm Display/NoDisplay.pm

[email protected] Mon, 27 Feb 2012 01:49:29 -0000
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: mherger
Date: Sun Feb 26 17:49:29 2012
New Revision: 33866

URL: http://svn.slimdevices.com/slim?rev=33866&view=rev
Log:
Bug: 15749
Description: respect duration in showBrieflies on Squeezeplay

Modified:
    7.7/trunk/server/Slim/Control/Queries.pm
    7.7/trunk/server/Slim/Control/Request.pm
    7.7/trunk/server/Slim/Display/Display.pm
    7.7/trunk/server/Slim/Display/NoDisplay.pm

Modified: 7.7/trunk/server/Slim/Control/Queries.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Control/Queries.pm?rev=33866&r1=33865&r2=33866&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Control/Queries.pm (original)
+++ 7.7/trunk/server/Slim/Control/Queries.pm Sun Feb 26 17:49:29 2012
@@ -1056,9 +1056,10 @@
 	my $myclientid = $self->clientid() || return 0; 
 	return 0 if $clientid ne $myclientid;
 
-	my $subs  = $self->getParam('subscribe');
-	my $type  = $request->getParam('_type');
-	my $parts = $request->getParam('_parts');
+	my $subs     = $self->getParam('subscribe');
+	my $type     = $request->getParam('_type');
+	my $parts    = $request->getParam('_parts');
+	my $duration = $request->getParam('_duration');
 
 	# check displaynotify type against subscription ('showbriefly', 'update', 'bits', 'all')
 	if ($subs eq $type || ($subs eq 'bits' && $type ne 'showbriefly') || $subs eq 'all') {
@@ -1072,8 +1073,9 @@
 		return 0 if ($type eq 'update' && !$self->client->display->renderCache->{'screen1'}->{'changed'});
 
 		# store display info in subscription request so it can be accessed by displaystatusQuery
-		$pd->{'type'}  = $type;
-		$pd->{'parts'} = $parts;
+		$pd->{'type'}     = $type;
+		$pd->{'parts'}    = $parts;
+		$pd->{'duration'} = $duration;
 
 		# execute the query immediately
 		$self->__autoexecute;
@@ -1098,10 +1100,11 @@
 	# return any previously stored display info from displaynotify
 	if (my $pd = $request->privateData) {
 
-		my $client= $request->client;
-		my $format= $pd->{'format'};
-		my $type  = $pd->{'type'};
-		my $parts = $type eq 'showbriefly' ? $pd->{'parts'} : $client->display->renderCache;
+		my $client   = $request->client;
+		my $format   = $pd->{'format'};
+		my $type     = $pd->{'type'};
+		my $parts    = $type eq 'showbriefly' ? $pd->{'parts'} : $client->display->renderCache;
+		my $duration = $pd->{'duration'};
 
 		$request->addResult('type', $type);
 
@@ -1143,7 +1146,13 @@
 					$request->addResult('display', $parts->{'jive'} );
 				}
 			} else {
-				$request->addResult('display', { 'text' => $screen1->{'line'} || $screen1->{'center'} });
+				my $display = { 
+					'text' => $screen1->{'line'} || $screen1->{'center'}
+				};
+				
+				$display->{duration} = $duration if $duration;
+				
+				$request->addResult('display', $display);
 			}
 		}
 

Modified: 7.7/trunk/server/Slim/Control/Request.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Control/Request.pm?rev=33866&r1=33865&r2=33866&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Control/Request.pm (original)
+++ 7.7/trunk/server/Slim/Control/Request.pm Sun Feb 26 17:49:29 2012
@@ -653,7 +653,7 @@
 	addDispatch(['library',        'changed',        '_newvalue'],                                     [0, 0, 0, undef]);
 	addDispatch(['unknownir',      '_ircode',        '_time'],                                         [1, 0, 0, undef]);
 	addDispatch(['prefset',        '_namespace',     '_prefname',  '_newvalue'],                       [0, 0, 1, undef]);
-	addDispatch(['displaynotify',  '_type',          '_parts'],                                        [1, 0, 0, undef]);
+	addDispatch(['displaynotify',  '_type',          '_parts', '_duration'],                           [1, 0, 0, undef]);
 	addDispatch(['alarm',          'sound',          '_id'],                                           [1, 0, 0, undef]);
 	addDispatch(['alarm',          'end',            '_id'],                                           [1, 0, 0, undef]);
 	addDispatch(['alarm',          'snooze',         '_id'],                                           [1, 0, 0, undef]);

Modified: 7.7/trunk/server/Slim/Display/Display.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Display/Display.pm?rev=33866&r1=33865&r2=33866&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Display/Display.pm (original)
+++ 7.7/trunk/server/Slim/Display/Display.pm Sun Feb 26 17:49:29 2012
@@ -283,7 +283,7 @@
 
 	# notify cli/jive of the show briefly message
 	if ($display->notifyLevel >= 1) {
-		$display->notify('showbriefly', $parts);
+		$display->notify('showbriefly', $parts, $duration);
 	}
 
 	if ($firstLine && ($display->linesPerScreen() == 1)) {
@@ -904,9 +904,10 @@
 	my $display = shift;
 	my $type    = shift;
 	my $info    = shift;
+	my $duration= shift;
 
 	# send a notification for this display update to 'displaystatus' queries
-	Slim::Control::Request->new($display->client->id, ['displaynotify', $type, $info])->notify('displaystatus');
+	Slim::Control::Request->new($display->client->id, ['displaynotify', $type, $info, $duration])->notify('displaystatus');
 }
 
 =head1 SEE ALSO

Modified: 7.7/trunk/server/Slim/Display/NoDisplay.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Display/NoDisplay.pm?rev=33866&r1=33865&r2=33866&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Display/NoDisplay.pm (original)
+++ 7.7/trunk/server/Slim/Display/NoDisplay.pm Sun Feb 26 17:49:29 2012
@@ -62,6 +62,16 @@
 sub maxBrightness {}
 sub symbols {return $_[1];}
 
+
+sub notify {
+	my ($display, $type, $info, $duration) = @_;
+	
+	# Squeezeplay is expecting duration in milliseconds - we're going to assume any value < 1000 to be seconds
+	$duration *= 1000 if $duration && $duration < 1000;
+
+	$display->SUPER::notify($type, $info, $duration)
+}
+
 =head1 SEE ALSO
 
 L<Slim::Display::Display>