O.K. So there.
Apply this diff to .../Slim/Web/Pages.pm:
Code:
--------------------
*** Slim/Web/Pages.pm.orig Mon Oct 24 23:47:21 2005
--- Slim/Web/Pages.pm Thu Oct 27 22:15:26 2005
***************
*** 157,162 ****
--- 157,171 ----
return sprintf("%s %s", $count, $word);
}
+ my $song_count = 0;
+ my $artist_count = 0;
+ my $album_count = 0;
+ my $genre_count = 0;
+
+ sub resetStats {
+ $song_count = 0;
+ }
+
sub addLibraryStats {
my ($params, $genre, $artist, $album) = @_;
***************
*** 185,200 ****
$find->{'contributor.role'} = $ds->artistOnlyRoles;
}
! $params->{'song_count'} = _lcPlural($ds->count('track', $find),
'SONG', 'SONGS');
! $params->{'artist_count'} = _lcPlural($ds->count('contributor',
$find), 'ARTIST', 'ARTISTS');
! $params->{'album_count'} = _lcPlural($ds->count('album', $find),
'ALBUM', 'ALBUMS');
# Right now hitlist.html is the only page that uses genre_count -
# which can be expensive. Only generate it if we need to.
if ($params->{'path'} =~ /hitlist/) {
! $params->{'genre_count'} = _lcPlural($ds->count('genre',
$find), 'GENRE', 'GENRES');
}
}
# Send the status page (what we're currently playing, contents of the
playlist)
--- 194,216 ----
$find->{'contributor.role'} = $ds->artistOnlyRoles;
}
!
! if ($song_count eq 0) {
! $song_count = _lcPlural($ds->count('track', $find), 'SONG',
'SONGS');
! $artist_count = _lcPlural($ds->count('contributor', $find),
'ARTIST', 'ARTISTS');
! $album_count = _lcPlural($ds->count('album', $find),
'ALBUM', 'ALBUMS');
! }
# Right now hitlist.html is the only page that uses genre_count -
# which can be expensive. Only generate it if we need to.
if ($params->{'path'} =~ /hitlist/) {
! $genre_count = _lcPlural($ds->count('genre', $find), 'GENRE',
'GENRES');
}
+ $params->{'song_count'} = $song_count;
+ $params->{'artist_count'} = $artist_count;
+ $params->{'album_count'} = $album_count;
+ $params->{'genre_count'} = $genre_count;
}
# Send the status page (what we're currently playing, contents of the
playlist)
--------------------
And this to .../Slim/Music/Import.pm:
Code:
--------------------
*** Slim/Music/Import.pm.orig Mon Oct 24 23:47:21 2005
--- Slim/Music/Import.pm Thu Oct 27 22:14:39 2005
***************
*** 178,183 ****
--- 178,185 ----
$ds->cleanupStaleEntries();
}
+
+ Slim::Web::resetStats();
}
}
--------------------
This does the database scan once at start and after each rescan
(although I did not test that). It does not change the counts when you
change the preferences, though. The logic employed in that area was
beyond my comprehension and is left as an exercise to the reader ;-)
This quick hack works for now, but is a mess architecture-wise, so I
would object to putting that into the code as a permanent fix.
--
meyergru
_______________________________________________
Discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss