view vixm/playlist.py @ 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 eaa800169f5b
children ae3451bedeb6
line wrap: on
line source

# a playlist definition

import xmms

LIST_PRIO	= 0
LIST_DEFAULT	= 1

class playlist:
	def __init__(self, allowrandom=False):
		self.__list = []
		self.__allowrand = allowrandom # allow randomization of this list
	
	def enqueue(self, song):
		""" Append a song to the list """
		self.__list.append(song)
	
	def dequeue(self, song):
		""" Remove a song from the list """
		self.__list.remove(song)
	
	def pop(self):
		""" Pop the next song """
		return self.__list.pop(0)

	def __getitem__(self, i):
		""" Get item at position i """
		return self.__list[i]

	def __len__(self):
		""" Return the length of the playlist """
		return len(self.__list)

	def index(self, song):
		""" Returns the index of the first occurence of song """
		return self.__list.index(song)