libsaria: Added function for listing the library

This makes it easier for the gui to know what is in the library.
This commit is contained in:
Bryan Schumaker 2011-06-18 11:09:44 -04:00
parent f09f80cd65
commit 083cbf738c
2 changed files with 9 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import index
# Function pointers for conveniance
add_path = library.add_path
list_paths = library.list_paths
get_attrs = library.get_attrs
all_attrs = library.all_attrs
list_ids = tree.list_ids

View File

@ -39,6 +39,14 @@ def add_path(path):
lib_dict.setdefault(path, dict())
unlock_library()
def list_paths():
res = []
lock_library()
for path, lib in lib_dict.iteritems():
res.append((path, lib))
unlock_library()
return res
def find_id(id):
for src, tracks in lib_dict.iteritems():
track = tracks.get(id, None)