[Slim-Checkins] r10056 - in /branches/6.5/server/Slim: Buttons/Common.pm Player/Client.pm

kdf at svn.slimdevices.com kdf at svn.slimdevices.com
Tue Sep 26 19:43:07 PDT 2006


Author: kdf
Date: Tue Sep 26 19:43:05 2006
New Revision: 10056

URL: http://svn.slimdevices.com?rev=10056&view=rev
Log:
Bug: 4205
Description: merge -r10054:10055 from trunk


Modified:
    branches/6.5/server/Slim/Buttons/Common.pm
    branches/6.5/server/Slim/Player/Client.pm

Modified: branches/6.5/server/Slim/Buttons/Common.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Buttons/Common.pm?rev=10056&r1=10055&r2=10056&view=diff
==============================================================================
--- branches/6.5/server/Slim/Buttons/Common.pm (original)
+++ branches/6.5/server/Slim/Buttons/Common.pm Tue Sep 26 19:43:05 2006
@@ -874,7 +874,7 @@
 		}
 
 		# add the 'after this song' option only if there is a defined value.
-		my @sleepChoices = $remaining ? sort(0, $remaining, 15,30,45,60,90) : (0,15,30,45,60,90);
+		my @sleepChoices = $remaining ? sort({$a <=> $b} (0, $remaining, 15,30,45,60,90)) : (0,15,30,45,60,90);
 		my $i = 0;
 
 		# find the next value for the sleep timer

Modified: branches/6.5/server/Slim/Player/Client.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Client.pm?rev=10056&r1=10055&r2=10056&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Client.pm (original)
+++ branches/6.5/server/Slim/Player/Client.pm Tue Sep 26 19:43:05 2006
@@ -755,10 +755,13 @@
 	my $sleeptime = $client->sleepTime() - Time::HiRes::time();
 	my $sleepstring = "";
 	
+	my $dur = Slim::Player::Source::playingSongDuration($client);
+	my $remaining = $dur - Slim::Player::Source::songTime($client);
+	
 	if ($client->sleepTime) {
 		
-		# assumes that remaining time was under 15 minutes.  might need to check against every default value just to cover all cases.
-		if ($client->currentSleepTime < 15) {
+		# check against remaining time to see if sleep time matches within 1 second.
+		if (int($sleeptime + 0.5) == int($remaining)) {
 			$sleepstring = join(' ',$client->string('SLEEPING_AT'),$client->string('END_OF_SONG'));
 		} else {
 			$sleepstring = join(" " ,$client->string('SLEEPING_IN'),int($sleeptime/60)+1,$client->string('MINUTES'));



More information about the checkins mailing list