Mercurial > vixm
changeset 33:99983189d4b2 master
Redo next song selection logic
author | Josef "Jeff" Sipek <jeffpc@josefsipek.net> |
---|---|
date | Fri, 03 Nov 2006 23:27:49 -0500 |
parents | f97eb9f0c207 |
children | 8028f2addb00 |
files | vixm/playlist.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/vixm/playlist.py Fri Nov 03 23:26:35 2006 -0500 +++ b/vixm/playlist.py Fri Nov 03 23:27:49 2006 -0500 @@ -32,14 +32,19 @@ def next(self): """ Get the next song """ - idx = random.randint(0, len(self.__list)-1) + def rnd(): + return random.randint(0, len(self.__list)-1) + + ## + + idx = self.__cursor if not self.__allowrand: - idx = self.__cursor - self.__cursor += 1 if self.__cursor >= len(self.__list): self.__cursor = 0 + else: + self.__cursor = rnd() return self.__list[idx]