diff vixm/ui.py @ 3:dd00b69169c6

Created initial ui thread code, fixed up playlist code
author Josef "Jeff" Sipek <jeffpc@josefsipek.net>
date Sat, 12 Aug 2006 21:00:00 -0400
parents
children 187453f856a7
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vixm/ui.py	Sat Aug 12 21:00:00 2006 -0400
@@ -0,0 +1,44 @@
+# all the user interface related bits
+
+import time
+from threading import Thread
+import xmms
+
+import playlist, song
+
+def run():
+	""" this is where we start execution """
+
+	# first, let's create the two playlists
+	print "Creating playlists..."
+	lists = {}
+	lists[playlist.LIST_PRIO]	= playlist.playlist()
+	lists[playlist.LIST_DEFAULT]	= playlist.playlist(allowrandom=True)
+
+	# read in the info for all the songs in XMMS's playlist
+	print "Loading songs from XMMS's playlist..."
+	songs = []
+	listlength = xmms.control.get_playlist_length()
+	for i in range(0,listlength):
+		s = song.song(i)
+		lists[playlist.LIST_DEFAULT].enqueue(s)
+	
+	print "Instanciating ui thread..."
+	ui = uiThread()
+	ui.start()
+
+	while True:
+		print "Checking for xmms events"
+		time.sleep(1)
+
+class uiThread(Thread):
+	""" This is the main ui thread class, it does all the magic
+	necessary to have a vi-like interface """
+	def __init__(self):
+		Thread.__init__(self)
+
+	def run(self):
+		while True:
+			print "Checking for ui events"
+			time.sleep(1)
+