From 597694b58b5a0dbc657f67d859b99e9c984384da Mon Sep 17 00:00:00 2001 From: "adrian.sampson" Date: Thu, 9 Apr 2009 08:47:12 +0000 Subject: [PATCH] fixed current_index update for general reordering cases --HG-- extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40198 --- beets/player/bpd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/beets/player/bpd.py b/beets/player/bpd.py index 7f15431b7..b2b01afaa 100755 --- a/beets/player/bpd.py +++ b/beets/player/bpd.py @@ -138,7 +138,6 @@ def seq_to_path(seq): """Encodes a sequence of strings as a path-like string. The sequence can be recovered exactly using path_to_list. """ - out = [] for s in seq: out.append(s.replace('\\', '\\\\').replace('/', '\\/')) @@ -149,7 +148,6 @@ def path_to_list(path): """Takes a path-like string (probably encoded by seq_to_path) and returns the list of strings it represents. """ - # To simplify parsing, ensure that everything is terminated by a # slash. Note that seq_to_path never added a trailing slash, so # they are "disallowed" by this encoding. @@ -387,6 +385,10 @@ class BaseServer(object): # Update currently-playing song. if idx_from == self.current_index: self.current_index = idx_to + elif idx_from < self.current_index <= idx_to: + self.current_index -= 1 + elif idx_from > self.current_index >= idx_to: + self.current_index += 1 self.playlist_version += 1