[Slim-Checkins] r11130 - in /trunk/server: HTML/EN/progress.html Slim/Web/Pages/Progress.pm

adrian at svn.slimdevices.com adrian at svn.slimdevices.com
Sat Jan 6 00:46:02 PST 2007


Author: adrian
Date: Sat Jan  6 00:46:02 2007
New Revision: 11130

URL: http://svn.slimdevices.com?rev=11130&view=rev
Log:
Bug: N/A
Description: avoid rounding problems with progress page bar length,
also make it a param so skins can set length

Modified:
    trunk/server/HTML/EN/progress.html
    trunk/server/Slim/Web/Pages/Progress.pm

Modified: trunk/server/HTML/EN/progress.html
URL: http://svn.slimdevices.com/trunk/server/HTML/EN/progress.html?rev=11130&r1=11129&r2=11130&view=diff
==============================================================================
--- trunk/server/HTML/EN/progress.html (original)
+++ trunk/server/HTML/EN/progress.html Sat Jan  6 00:46:02 2007
@@ -30,7 +30,7 @@
 setTimeout( "refresh()", [% refresh %] * 1000);
 
 function refresh() {
-	window.location.replace("[% webroot	%]progress.html?type=[% type %]&player=[% player | uri %]");
+	window.location.replace("[% webroot	%]progress.html?type=[% type %]&player=[% player | uri %]&barlen=[% barlen %]");
 }
 
 </script>[% END %]

Modified: trunk/server/Slim/Web/Pages/Progress.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Web/Pages/Progress.pm?rev=11130&r1=11129&r2=11130&view=diff
==============================================================================
--- trunk/server/Slim/Web/Pages/Progress.pm (original)
+++ trunk/server/Slim/Web/Pages/Progress.pm Sat Jan  6 00:46:02 2007
@@ -11,21 +11,22 @@
 sub progress {
 	my ($client, $params) = @_;
 
+	my $barLen = $params->{'barlen'} || 25;
+
 	my $args = {};
 
 	$args->{'type'} = $params->{'type'} if $params->{'type'};
-	$args->{'name'} = $params->{'name'} if $params->{'name'};
-	$args->{'active'} = $params->{'active'} if $params->{'active'};
 
 	my @progress = Slim::Schema->rs('Progress')->search( $args )->all;
 
 	for my $p (@progress) {
 
 		my $bar = '';
+		my $barInc = $p->total / $barLen;
 
-		for (my $i = 0; $i < $p->total; $i += $p->total / 25) {
+		for (my $i = 0; $i < $barLen; $i++) {
 
-			$params->{'cell_full'} = $i < $p->done;
+			$params->{'cell_full'} = $i * $barInc < $p->done;
 			$bar .= ${Slim::Web::HTTP::filltemplatefile("hitlist_bar.html", $params)};
 		}
 



More information about the checkins mailing list