Mercurial > vixm
comparison vixm/ui.py @ 6:50745af6a63b
Print song lengths in something better than number of milliseconds, added
":lists" command to list all the playlists
author | Josef "Jeff" Sipek <jeffpc@josefsipek.net> |
---|---|
date | Fri, 18 Aug 2006 20:32:00 -0400 |
parents | 187453f856a7 |
children | f87b969fa973 |
comparison
equal
deleted
inserted
replaced
5:187453f856a7 | 6:50745af6a63b |
---|---|
2 | 2 |
3 import time, sys | 3 import time, sys |
4 from threading import Thread | 4 from threading import Thread |
5 import xmms | 5 import xmms |
6 | 6 |
7 import playlist, song | 7 import playlist, song, util |
8 | 8 |
9 def run(): | 9 def run(): |
10 """ this is where we start execution """ | 10 """ this is where we start execution """ |
11 | 11 |
12 # first, let's create the two playlists | 12 # first, let's create the two playlists |
39 self.lists = lists | 39 self.lists = lists |
40 self.shutdown = False | 40 self.shutdown = False |
41 | 41 |
42 def __enqueue(self, id): | 42 def __enqueue(self, id): |
43 s = self.lists[playlist.LIST_DEFAULT][id] | 43 s = self.lists[playlist.LIST_DEFAULT][id] |
44 print "Enqueuing song: %d. %s (%d)" % (id, s["title"], s["time"]) | 44 print "Enqueuing song: %d. %s (%s)" % (id, s["title"], |
45 util.strtime(s["time"])) | |
45 self.lists[playlist.LIST_PRIO].enqueue(s) | 46 self.lists[playlist.LIST_PRIO].enqueue(s) |
46 | 47 |
47 def __cmd(self, txt): | 48 def __cmd(self, txt): |
48 parts = txt.split() | 49 parts = txt.split() |
49 cmd = parts[0] | 50 cmd = parts[0] |
63 return | 64 return |
64 else: | 65 else: |
65 listid = playlist.LIST_PRIO | 66 listid = playlist.LIST_PRIO |
66 | 67 |
67 for s in self.lists[listid]: | 68 for s in self.lists[listid]: |
68 print "%d. %s (%d)" % (i, s["title"], s["time"]) | 69 print "%d. %s (%s)" % (i, s["title"], |
70 util.strtime(s["time"])) | |
69 i += 1 | 71 i += 1 |
72 elif cmd == "lists": | |
73 print "#0 LIST_PRIO" | |
74 print "#1 LIST_DEFAULT" | |
70 else: | 75 else: |
71 print "Invalid command \"%s\"" % (cmd,) | 76 print "Invalid command \"%s\"" % (cmd,) |
72 | 77 |
73 def run(self): | 78 def run(self): |
74 while not self.shutdown: | 79 while not self.shutdown: |