libsaria: Fix queue num_visible()

When songs are removed from the queue, they should also be removed from
the visible set, otherwise num_visible() will never change.
This commit is contained in:
Bryan Schumaker 2011-05-29 14:23:02 -04:00
parent c9dee00727
commit 884c55cdd5
1 changed files with 13 additions and 4 deletions

View File

@ -6,9 +6,15 @@ import queue
visible = set()
# Function pointers for convenience
rm_ids = queue.rm_ids
reset = queue.reset
def rm_ids(ids):
global visible
visible = visible - set(ids)
queue.rm_ids(ids)
def reset():
global visible
visible = set()
queue.reset()
def list_ids():
for id in queue.queue_list:
@ -29,5 +35,8 @@ def num_visible():
return len(visible)
def next():
return queue.pop()
id = queue.pop()
if id != None:
visible.remove(id)
return id