changeset 48:3eee483b5c4e pure

start with random song if we're supposed to randomize
author Josef "Jeff" Sipek <jeffpc@josefsipek.net>
date Mon, 06 Nov 2006 05:32:34 -0500
parents 1ae315a49009
children fa451278826b
files vixm/main.py vixm/playlist.py
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/vixm/main.py	Mon Nov 06 05:25:05 2006 -0500
+++ b/vixm/main.py	Mon Nov 06 05:32:34 2006 -0500
@@ -24,6 +24,8 @@
 		lists[playlist.LIST_DEFAULT].enqueue(s)
 
 		idx += 1
+
+	lists[playlist.LIST_DEFAULT].first_song()
 	
 	print "Instanciating player thread..."
 	play = player.playerThread()
--- a/vixm/playlist.py	Mon Nov 06 05:25:05 2006 -0500
+++ b/vixm/playlist.py	Mon Nov 06 05:32:34 2006 -0500
@@ -15,8 +15,11 @@
 	def __init__(self, allowrandom=False):
 		self.__list = []
 		self.__allowrand = allowrandom # allow randomization of this list
-		self.__cursor = 0
+		self.__cursor = -1
 	
+	def first_song(self):
+		self.__cursor = self.__allowrand and self.__rnd() or 0
+
 	def enqueue(self, song):
 		""" Append a song to the list """
 		self.__list.append(song)