changeset 11:50584a5c300e

Fixed up code to make more sense
author Josef "Jeff" Sipek <jeffpc@josefsipek.net>
date Sat, 19 Aug 2006 20:06:56 -0400
parents 14227a071579
children b5370c42288b
files vixm/playlist.py vixm/ui.py
diffstat 2 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/vixm/playlist.py	Sat Aug 19 20:03:36 2006 -0400
+++ b/vixm/playlist.py	Sat Aug 19 20:06:56 2006 -0400
@@ -20,10 +20,7 @@
 	
 	def pop(self):
 		""" Pop the next song """
-		try:
-			return self.__list.pop(0)
-		except IndexError:
-			return None
+		return self.__list.pop(0)
 
 	def __getitem__(self, i):
 		""" Get item at position i """
--- a/vixm/ui.py	Sat Aug 19 20:03:36 2006 -0400
+++ b/vixm/ui.py	Sat Aug 19 20:06:56 2006 -0400
@@ -36,17 +36,19 @@
 		# if it is different from what we played last time we
 		# checked...
 		if current != last:
-			# pop song off the PRIO queue
-			next = lists[playlist.LIST_PRIO].pop()
+			try:
+				# pop song off the PRIO queue
+				next = lists[playlist.LIST_PRIO].pop()
 
-			# if successful, play the popped song
-			if next:
-				try: 
-					idx = lists[playlist.LIST_DEFAULT].index(next)
-					xmms.control.set_playlist_pos(idx)
-					current = next
-				except ValueError:
-					print "WTF is going on?!"
+				# if successful, play the popped song
+				idx = lists[playlist.LIST_DEFAULT].index(next)
+				xmms.control.set_playlist_pos(idx)
+				current = next
+			except IndexError:
+				# no song to pop
+				pass
+			except ValueError:
+				print "WTF is going on?!"
 
 		# update last played song
 		last = current