2010-08-08 14:30:15 -04:00
|
|
|
# Bryan Schumaker (8/8/2010)
|
|
|
|
|
|
|
|
__all__ = ["collection"]
|
|
|
|
|
|
|
|
import libsaria
|
|
|
|
import tagpy
|
|
|
|
call = libsaria.event.call
|
|
|
|
exists = libsaria.path.exists
|
|
|
|
expand = libsaria.path.expand
|
|
|
|
FileRef = tagpy.FileRef
|
|
|
|
|
|
|
|
LIBRARY = 0
|
|
|
|
PLAYLIST = 1
|
|
|
|
QUEUE = 2
|
|
|
|
|
|
|
|
import collection
|
2010-08-19 23:02:30 -04:00
|
|
|
library = collection.Collection()
|
2010-08-08 14:30:15 -04:00
|
|
|
|
|
|
|
def new_source(path, bg=True):
|
2010-08-19 23:02:30 -04:00
|
|
|
global library
|
2010-08-08 14:30:15 -04:00
|
|
|
path = expand(path)
|
|
|
|
if not exists(path):
|
|
|
|
return 0
|
2010-08-19 23:02:30 -04:00
|
|
|
return call("NEWSOURCE", library.scan, path)
|
|
|
|
|
|
|
|
|
|
|
|
def walk_library():
|
|
|
|
global library
|
|
|
|
for track in library:
|
|
|
|
yield track
|
2010-08-08 14:30:15 -04:00
|
|
|
|
2010-08-20 19:37:55 -04:00
|
|
|
|
|
|
|
def lib_get_attr(id, attr):
|
|
|
|
global library
|
|
|
|
return library.get_attr(id, attr)
|
|
|
|
|