annotate vixm/player.py @ 32:f97eb9f0c207 master

Add random song selection for default queue
author Josef "Jeff" Sipek <jeffpc@josefsipek.net>
date Fri, 03 Nov 2006 23:26:35 -0500
parents 860c891de6bb
children 8028f2addb00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
1 import time
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
2 from threading import Thread
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
3
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
4 class playerThread(Thread):
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
5 def __init__(self, lists):
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
6 Thread.__init__(self)
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
7
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
8 self.shutdown = False
32
f97eb9f0c207 Add random song selection for default queue
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents: 30
diff changeset
9 self.playing = False
f97eb9f0c207 Add random song selection for default queue
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents: 30
diff changeset
10
f97eb9f0c207 Add random song selection for default queue
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents: 30
diff changeset
11 self.last = None
30
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
12
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
13 self.lists = lists
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
14
32
f97eb9f0c207 Add random song selection for default queue
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents: 30
diff changeset
15 def play(self, s):
f97eb9f0c207 Add random song selection for default queue
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents: 30
diff changeset
16 print "about to play %s" % (str(s),)
f97eb9f0c207 Add random song selection for default queue
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents: 30
diff changeset
17
30
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
18 def run(self):
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
19 while not self.shutdown:
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
20 time.sleep(0.5)
860c891de6bb Remove lots of xmms-related code & get ready to make the whole program a
Josef "Jeff" Sipek <jeffpc@josefsipek.net>
parents:
diff changeset
21