Mercurial > vixm
diff vixm/ui.py @ 9:eaa800169f5b v0.10
Hooked up the playlists to control xmms!
Also added help string to all the commands, and added a stub for help
command
author | Josef "Jeff" Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 19 Aug 2006 20:02:59 -0400 |
parents | 79340745c952 |
children | 50584a5c300e |
line wrap: on
line diff
--- a/vixm/ui.py Sat Aug 19 19:41:06 2006 -0400 +++ b/vixm/ui.py Sat Aug 19 20:02:59 2006 -0400 @@ -27,8 +27,32 @@ ui = uiThread(lists) ui.start() + last = None while not ui.shutdown: - time.sleep(1) + # check which song we are playing now + pos = xmms.control.get_playlist_pos() + current = lists[playlist.LIST_DEFAULT][pos] + + # if it is different from what we played last time we + # checked... + if current != last: + # pop song off the PRIO queue + next = lists[playlist.LIST_PRIO].pop() + + # if successful, play the popped song + if next: + try: + idx = lists[playlist.LIST_DEFAULT].index(next) + xmms.control.set_playlist_pos(idx) + current = next + except ValueError: + print "WTF is going on?!" + + # update last played song + last = current + + # sleep + time.sleep(0.5) class uiThread(Thread): """ This is the main ui thread class, it does all the magic @@ -115,6 +139,9 @@ def __cmd_dequeue(ui, start, stop, args): print "not implemented yet" + def __cmd_help(ui, start, stop, args): + print "not implemented yet" + def __do_list(ui, start, stop, number, args): # get the list id from the argument or default to # LIST_PRIO @@ -161,15 +188,17 @@ cmdtable = { "q([!]){,1}": - (__cmd_quit, False), + (__cmd_quit, False, "q[!]"), "n( ([0-9]+)){,1}": - (__cmd_number, True), + (__cmd_number, True, "[range]n [playlistid]"), "l( ([0-9]+)){,1}": - (__cmd_list, True), + (__cmd_list, True, "[range]l [playlistid]"), "a ([0-9]+)": - (__cmd_enqueue, False), + (__cmd_enqueue, False, "a [songid]"), "d ([0-9]+)": - (__cmd_dequeue, False), + (__cmd_dequeue, False, "d [songid]"), + "h": + (__cmd_help, False, "h"), } def special2int(s):