[Slim-Checkins] r9430 - /trunk/server/Slim/Buttons/Playlist.pm
adrian at svn.slimdevices.com
adrian at svn.slimdevices.com
Tue Sep 5 13:01:13 PDT 2006
Author: adrian
Date: Tue Sep 5 13:01:11 2006
New Revision: 9430
URL: http://svn.slimdevices.com?rev=9430&view=rev
Log:
Bug: N/A
Description: fix bumps for knob with playlists of 0 or 1 items
Modified:
trunk/server/Slim/Buttons/Playlist.pm
Modified: trunk/server/Slim/Buttons/Playlist.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Playlist.pm?rev=9430&r1=9429&r2=9430&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Playlist.pm (original)
+++ trunk/server/Slim/Buttons/Playlist.pm Tue Sep 5 13:01:11 2006
@@ -96,8 +96,12 @@
my $newindex = $client->knobPos();
my $oldindex = browseplaylistindex($client);
-
- if ($oldindex != $newindex) {
+ my $songcount = Slim::Player::Playlist::count($client);
+
+ # XXXX assume list is long enough for wrapround to only occur when:
+ my $wrap = (abs($newindex - $oldindex) > $songcount / 2);
+
+ if ($oldindex != $newindex && $songcount > 1) {
browseplaylistindex($client,$newindex);
}
@@ -105,21 +109,23 @@
$::d_ui && msgf("funct: [$funct] old: $oldindex new: $newindex is after setting: [%s]\n", browseplaylistindex($client));
- my ($songcount) = Slim::Player::Playlist::count($client);
-
- if ($songcount < 2 && $oldindex == 0 && $newindex == -1) {
-
- $client->bumpDown;
-
- } elsif ($songcount < 2 && $oldindex == -1 && $newindex == 0) {
-
- $client->bumpUp;
-
- } elsif ($oldindex > $newindex) {
+ if ($songcount < 2) {
+
+ if ($newindex < 0) {
+
+ $client->bumpDown;
+
+ } elsif ($newindex > 0) {
+
+ $client->bumpUp;
+
+ }
+
+ } elsif ($oldindex > $newindex && !$wrap || $oldindex < $newindex && $wrap) {
$client->pushUp;
- } elsif ($oldindex < $newindex) {
+ } else {
$client->pushDown;
}
@@ -460,12 +466,11 @@
}
# update list length for the knob. ### HACK ATTACK ###
- #
- # Only do when we are in mode playlist
- # See Bug: 3561
+ # - only do when we are in mode playlist - see bug: 3561
+ # - use length of 1 for both 1 item lists and empty playlists
if (Slim::Buttons::Common::mode($client) eq 'playlist') {
- $client->param('listLen', Slim::Player::Playlist::count($client));
+ $client->param('listLen', Slim::Player::Playlist::count($client) || 1);
}
# get (and optionally set) the browseplaylistindex parameter that's kept in param stack
More information about the checkins
mailing list