libsaria: Playlist uses new list functions

They were built in to the sources/ layer in 4.6.  It makes sense to use
them for the playlist.
This commit is contained in:
Bryan Schumaker 2011-05-12 08:25:44 -04:00
parent 2afabfcf21
commit 8b51871225
2 changed files with 7 additions and 8 deletions

View File

@ -73,7 +73,9 @@ def list_source(source, *attrs):
list_func = None
get_attrs = library.get_attrs
append = ret.append
if source == QUEUE:
if source == PLAYLIST:
list_func = playlist.list
elif source == QUEUE:
list_func = queue.list
if list_func != None:
for id in list_func():
@ -82,3 +84,6 @@ def list_source(source, *attrs):
def list_queue(*attrs):
return list_source(QUEUE, *attrs)
def list_playlist(*attrs):
return list_source(PLAYLIST, *attrs)

View File

@ -68,16 +68,10 @@ def startup():
def save():
libsaria.storage.save_obj("playlist", (playlist.song_list, recent, cur_index))
def walk():
def list():
for id in playlist.song_list:
yield id
def walk_playlist(*attrs):
res = []
for id in walk():
res.append(library.get_attrs(id, *attrs))
return res
def filter(text):
global visible
global song_set