import pygame

pygame.mixer.init()
pygame.display.init()

screen = pygame.display.set_mode ( ( 320 , 240 ) )

playlist = list()
playlist.append ( "Epoq-Lepidoptera.ogg" )
playlist.append ( "Hydrate-Kenny_Beltrey.ogg" )
playlist.append ( "Mists_of_Time-4T.ogg" )

pygame.mixer.music.load ( playlist.pop() )	# Get the first track from the playlist
pygame.mixer.music.queue ( playlist.pop() )	# Queue the 2nd song
pygame.mixer.music.set_endevent ( pygame.USEREVENT )	# Setup the end track event
pygame.mixer.music.play()			# Play the music

running = True
while running:
   for event in pygame.event.get():
      if event.type == pygame.USEREVENT:	# A track has ended
         if len ( playlist ) > 0:		# If there are more tracks in the queue...
            pygame.mixer.music.queue ( playlist.pop() )	# Queue the next one in the list
