[Slim-Checkins] r9214 - in /branches/6.5/server: HTML/EN/html/docs/display.html Slim/Buttons/Input/Bar.pm Slim/Buttons/Playlist.pm Slim/Buttons/ScreenSaver.pm Slim/Buttons/Volume.pm Slim/Player/Client.pm Slim/Player/Player.pm Slim/Player/Transporter.pm

adrian at svn.slimdevices.com adrian at svn.slimdevices.com
Mon Aug 28 10:44:43 PDT 2006


Author: adrian
Date: Mon Aug 28 10:44:37 2006
New Revision: 9214

URL: http://svn.slimdevices.com?rev=9214&view=rev
Log:
Bug: N/A
Description: merge from trunk 9201:9202 9210:9212

Modified:
    branches/6.5/server/HTML/EN/html/docs/display.html
    branches/6.5/server/Slim/Buttons/Input/Bar.pm
    branches/6.5/server/Slim/Buttons/Playlist.pm
    branches/6.5/server/Slim/Buttons/ScreenSaver.pm
    branches/6.5/server/Slim/Buttons/Volume.pm
    branches/6.5/server/Slim/Player/Client.pm
    branches/6.5/server/Slim/Player/Player.pm
    branches/6.5/server/Slim/Player/Transporter.pm

Modified: branches/6.5/server/HTML/EN/html/docs/display.html
URL: http://svn.slimdevices.com/branches/6.5/server/HTML/EN/html/docs/display.html?rev=9214&r1=9213&r2=9214&view=diff
==============================================================================
--- branches/6.5/server/HTML/EN/html/docs/display.html (original)
+++ branches/6.5/server/HTML/EN/html/docs/display.html Mon Aug 28 10:44:37 2006
@@ -766,5 +766,45 @@
 show the correct menu items, but will not perform the normal scrolling
 between menu items.</p>
 
+<hr></hr>
+<h4>Custom Server Mode Displays</h4>
+
+<p>6.5 supports custom lines functions for the volume display and
+playlist mode.  This allows a plugin to alter the built in screen
+displays for changing volume and playlist/now playing displays.</p>
+
+<p>A plugin should register alternative lines function at client
+connect time with the client methods customVolumeLines and
+customPlaylistLines.  For example:</p>
+
+<pre>
+sub initPlugin {
+    Slim::Control::Request::subscribe( \&newClient, [['client']], [['new']] );
+}
+
+sub newClient {
+    my $client = shift->client || return;
+    $client->customVolumeLines( \&volumeLines );
+    $client->customPlaylistLines( \&playlistLines );
+}
+
+sub volumeLines {
+    my $client = shift;
+    my $vol = shift;
+
+    if (!defined $vol && $client->param('valueRef')) {
+        $vol = ${$client->param('valueRef')};
+    }
+
+    # $vol is a value 0..100
+}
+
+sub playlistLines {
+    my $client = shift;
+
+    # see Slim::Buttons::Playlist::lines for details
+}
+</pre>
+
 <p></p>
 [% PROCESS helpfooter.html %]

Modified: branches/6.5/server/Slim/Buttons/Input/Bar.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Buttons/Input/Bar.pm?rev=9214&r1=9213&r2=9214&view=diff
==============================================================================
--- branches/6.5/server/Slim/Buttons/Input/Bar.pm (original)
+++ branches/6.5/server/Slim/Buttons/Input/Bar.pm Mon Aug 28 10:44:37 2006
@@ -411,9 +411,17 @@
 		}
 	}
 
-	my @overlay = $noOverlay ? undef : Slim::Buttons::Input::List::getExtVal($client, $valueRef, $listIndex, 'overlayRef');
-
-	return ($line1, $line2, @overlay);
+	my ($overlay1, $overlay2) = Slim::Buttons::Input::List::getExtVal($client, $valueRef, $listIndex, 'overlayRef') unless $noOverlay;
+
+	$overlay1 = $client->symbols($overlay1) if defined($overlay1);
+	$overlay2 = $client->symbols($overlay2) if defined($overlay2);
+	
+	my $parts = {
+		'line'    => [ $line1, $line2 ],
+		'overlay' => [ $overlay1, $overlay2 ]
+	};
+
+	return $parts;
 }
 
 sub getFunctions {
@@ -433,7 +441,7 @@
 		}
 	#}
 
-	$client->lines(\&lines);
+	$client->lines( $client->param('lines') || \&lines );
 }
 
 sub exitInput {

Modified: branches/6.5/server/Slim/Buttons/Playlist.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Buttons/Playlist.pm?rev=9214&r1=9213&r2=9214&view=diff
==============================================================================
--- branches/6.5/server/Slim/Buttons/Playlist.pm (original)
+++ branches/6.5/server/Slim/Buttons/Playlist.pm Mon Aug 28 10:44:37 2006
@@ -314,7 +314,7 @@
 	my $client = shift;
 	my $how    = shift;
 
-	$client->lines(\&lines);
+	$client->lines( $client->customPlaylistLines() || \&lines );
 
 	if ($how ne 'pop') {
 		jump($client);
@@ -368,7 +368,9 @@
 
 	my ($parts, $line1, $line2);
 
-	if (showingNowPlaying($client) || (Slim::Player::Playlist::count($client) < 1)) {
+	my $nowPlaying = showingNowPlaying($client);
+
+	if ($nowPlaying || (Slim::Player::Playlist::count($client) < 1)) {
 
 		$parts = $client->currentSongLines();
 
@@ -397,7 +399,7 @@
 	}
 
 	if ($client->display->showExtendedText()) {
-		my $song = Slim::Player::Playlist::song($client, browseplaylistindex($client));
+		my $song = Slim::Player::Playlist::song($client, $nowPlaying ? undef : browseplaylistindex($client) );
 
 		$parts->{'screen2'} ||= {
 			'line' => [ 

Modified: branches/6.5/server/Slim/Buttons/ScreenSaver.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Buttons/ScreenSaver.pm?rev=9214&r1=9213&r2=9214&view=diff
==============================================================================
--- branches/6.5/server/Slim/Buttons/ScreenSaver.pm (original)
+++ branches/6.5/server/Slim/Buttons/ScreenSaver.pm Mon Aug 28 10:44:37 2006
@@ -191,17 +191,14 @@
 
 sub setMode {
 	my $client = shift;
+
 	$::d_time && msg("going into screensaver mode");
-	$client->lines(\&lines);
+
+	$client->lines( $client->customPlaylistLines() || \&Slim::Buttons::Playlist::lines );
+
 	# update client every second in this mode
 	$client->param('modeUpdateInterval', 1); # seconds
 	$client->param('screen2', 'screensaver');
-}
-
-sub lines {
-	my $client = shift;
-	$::d_time && msg("getting screensaver lines");
-	return Slim::Buttons::Playlist::lines($client);
 }
 
 =head1 SEE ALSO

Modified: branches/6.5/server/Slim/Buttons/Volume.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Buttons/Volume.pm?rev=9214&r1=9213&r2=9214&view=diff
==============================================================================
--- branches/6.5/server/Slim/Buttons/Volume.pm (original)
+++ branches/6.5/server/Slim/Buttons/Volume.pm Mon Aug 28 10:44:37 2006
@@ -76,8 +76,9 @@
 		'initialValue' => sub { return $_[0]->volume },
 		'valueRef'     => $client->volume,
 		'callback'     => \&volumeExitHandler,
+		'increment'    => 1,
+		'lines'        => $client->customVolumeLines(),
 		'screen2'      => 'inherit',
-		'increment'    => 1,
 	});
 
 	_volumeIdleChecker($client);

Modified: branches/6.5/server/Slim/Player/Client.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Client.pm?rev=9214&r1=9213&r2=9214&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Client.pm (original)
+++ branches/6.5/server/Slim/Player/Client.pm Mon Aug 28 10:44:37 2006
@@ -78,7 +78,7 @@
 
 	# The following indexes are unused:
 	# 2, 3, 8, 11, 12, 13, 16, 23, 24, 25, 26, 27, 33, 34, 53
-	# 64, 65, 66, 67, 68, 72, 82, 83, 94
+	# 64, 65, 66, 67, 68, 72, 82, 83
 
 	$client->[0] = $id;
 	$client->[1] = Slim::Utils::Prefs::getClientPrefs($id); # _prefs
@@ -154,6 +154,7 @@
 	$client->[91] = undef; # currentPlaylist
 	$client->[92] = undef; # currentPlaylistModified
 	$client->[93] = undef; # songElapsedSeconds
+	$client->[94] = undef; # customPlaylistLines
 	# 95 is currentPlaylistRender
 	# 96 is currentPlaylistChangeTime
 	$client->[97] = undef; # tempVolume temporary volume setting
@@ -163,7 +164,7 @@
 	$client->[101] = undef; # lines2periodic
 	$client->[102] = 0; # periodicUpdateTime
 	$client->[103] = undef; # musicInfoTextCache
-	$client->[104] = undef; # unused
+	$client->[104] = undef; # customVolumeLines
 	# 105 is scroll state
 	$client->[106] = undef; # knobPos
 	$client->[107] = undef; # knobTime
@@ -1543,6 +1544,11 @@
 	@_ ? ($r->[93] = shift) : $r->[93];
 }
 
+sub customPlaylistLines {
+	my $r = shift;
+	@_ ? ($r->[94] = shift) : $r->[94];
+}
+
 sub currentPlaylistRender {
 	my $r = shift;
 	@_ ? ($r->[95] = shift) : $r->[95];
@@ -1584,6 +1590,11 @@
 	@_ ? ($r->[103] = shift) : $r->[103];
 }
 
+sub customVolumeLines {
+	my $r = shift;
+	@_ ? ($r->[104] = shift) : $r->[104];
+}
+
 sub knobPos {
 	my $r = shift;
 	@_ ? ($r->[106] = shift) : $r->[106];

Modified: branches/6.5/server/Slim/Player/Player.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Player.pm?rev=9214&r1=9213&r2=9214&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Player.pm (original)
+++ branches/6.5/server/Slim/Player/Player.pm Mon Aug 28 10:44:37 2006
@@ -694,6 +694,7 @@
 	my $scale = $client->mixerConstant($feature, 'scale');
 
 	my $headerValue = '';
+	my $parts;
 
 	if ($client->mixerConstant($feature, 'balanced')) {
 
@@ -701,7 +702,15 @@
 
 	} elsif ($feature eq 'volume') {
 
-		$headerValue = $client->volumeString($featureValue);
+		if (my $linefunc = $client->customVolumeLines()) {
+
+			$parts = &$linefunc($client, $featureValue);
+
+		} else {
+			
+			$headerValue = $client->volumeString($featureValue);
+
+		}
 
 	} else {
 
@@ -720,15 +729,14 @@
 
 	$client->modeParam('visu', [0]);
 
-	my @lines = Slim::Buttons::Input::Bar::lines($client, $featureValue, $featureHeader, {
+	$parts ||= Slim::Buttons::Input::Bar::lines($client, $featureValue, $featureHeader, {
 		'min'       => $client->mixerConstant($feature, 'min'),
 		'mid'       => $mid,
 		'max'       => $client->mixerConstant($feature, 'max'),
 		'noOverlay' => 1,
 	});
 
-	# trim off any overlay for showBriefly
-	$client->display->showBriefly(@lines[0,1], { 'name' => 'mixer' } );
+	$client->display->showBriefly($parts, { 'name' => 'mixer' } );
 
 	# Turn the visualizer back to it's old value.
 	$client->modeParam('visu', $oldvisu);	

Modified: branches/6.5/server/Slim/Player/Transporter.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Transporter.pm?rev=9214&r1=9213&r2=9214&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Transporter.pm (original)
+++ branches/6.5/server/Slim/Player/Transporter.pm Mon Aug 28 10:44:37 2006
@@ -124,12 +124,21 @@
 sub volumeString {
 	my ($client, $volume) = @_;
 
-	if ($volume <= 0) {
+	if ($client->display->isa('Slim::Display::Transporter')) {
 
-		return sprintf(' (%s)', $client->string('MUTED'));
+		if ($volume <= 0) {
+
+			return sprintf(' (%s)', $client->string('MUTED'));
+		}
+
+		return sprintf(' (%.2f dB)', -abs(($volume / 2) - 50));
+
+	} else {
+
+		return $client->SUPER::volumeString($volume);
+
 	}
 
-	return sprintf(' (%.2f dB)', -abs(($volume / 2) - 50));
 }
 
 1;



More information about the checkins mailing list