libsaria: Switch most code to use all_attrs()
all_attrs() is my new way of doing things, so it makes sense to use it now.
This commit is contained in:
parent
5fcb590f53
commit
12cb9a900a
|
@ -71,7 +71,7 @@ def set_like(like=None):
|
||||||
callbacks.like_song(like)
|
callbacks.like_song(like)
|
||||||
|
|
||||||
def get_like():
|
def get_like():
|
||||||
return sources.get_attrs("like")
|
return sources.all_attrs()["like"]
|
||||||
|
|
||||||
def load(file):
|
def load(file):
|
||||||
file = expand(file)
|
file = expand(file)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import libsaria.xm as xml
|
||||||
|
|
||||||
add_child = xml.add_child
|
add_child = xml.add_child
|
||||||
add_text = xml.add_text
|
add_text = xml.add_text
|
||||||
get_attrs = libsaria.sources.get_attrs_id
|
get_attrs = libsaria.sources.library.get_attrs
|
||||||
file_id = path.file_id
|
file_id = path.file_id
|
||||||
lib_file = "library"
|
lib_file = "library"
|
||||||
vers = "%s.%s" % (version.__major__, version.__minor__)
|
vers = "%s.%s" % (version.__major__, version.__minor__)
|
||||||
|
|
|
@ -69,9 +69,9 @@ def lfm_cache_album(artist, album, title, file):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_album_art(file):
|
def get_album_art(file):
|
||||||
id, artist, album, title = sources.get_attrs("id", "artist", "album", "title")
|
attrs = sources.all_attrs()
|
||||||
file = cache.get_item(artist, album, title, "Folder.jpg", lfm_cache_album)
|
file = cache.get_item(attrs["artist"], attrs["album"], attrs["title"], "Folder.jpg", lfm_cache_album)
|
||||||
callbacks.get_art(file, id)
|
callbacks.get_art(file, attrs["id"])
|
||||||
|
|
||||||
def get_artwork(file):
|
def get_artwork(file):
|
||||||
threading.Thread(target=get_album_art, args=(file,)).start()
|
threading.Thread(target=get_album_art, args=(file,)).start()
|
||||||
|
|
|
@ -13,8 +13,11 @@ import attrs
|
||||||
attrs.load_dattrs()
|
attrs.load_dattrs()
|
||||||
cur_id = None
|
cur_id = None
|
||||||
|
|
||||||
|
def get_cur_id():
|
||||||
|
return cur_id
|
||||||
|
|
||||||
def inc_count():
|
def inc_count():
|
||||||
attrs.inc_count(get_attrs("id")[0])
|
attrs.inc_count(get_cur_id())
|
||||||
|
|
||||||
def find_attrs(file, *attr_list):
|
def find_attrs(file, *attr_list):
|
||||||
if file == None:
|
if file == None:
|
||||||
|
@ -78,9 +81,6 @@ def all_attrs():
|
||||||
res["count"] = attrs.get_count("count")
|
res["count"] = attrs.get_count("count")
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_cur_id():
|
|
||||||
return cur_id
|
|
||||||
|
|
||||||
def filter(text):
|
def filter(text):
|
||||||
visible = library.filter(text)
|
visible = library.filter(text)
|
||||||
playlist.set_visible(visible)
|
playlist.set_visible(visible)
|
||||||
|
@ -91,7 +91,7 @@ def is_visible(id):
|
||||||
return library.is_visible(id)
|
return library.is_visible(id)
|
||||||
|
|
||||||
def set_attr(attr, value):
|
def set_attr(attr, value):
|
||||||
id = get_attrs("id")[0]
|
id = get_cur_id()
|
||||||
if id:
|
if id:
|
||||||
attrs.set_dattr(id, attr, value)
|
attrs.set_dattr(id, attr, value)
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ def make_library(path):
|
||||||
def play_id(id):
|
def play_id(id):
|
||||||
global cur_id
|
global cur_id
|
||||||
cur_id = id
|
cur_id = id
|
||||||
file = get_attrs("filepath")[0]
|
file = all_attrs()["filepath"]
|
||||||
queue.rm_ids([id])
|
queue.rm_ids([id])
|
||||||
libsaria.controls.load(file)
|
libsaria.controls.load(file)
|
||||||
libsaria.controls.play()
|
libsaria.controls.play()
|
||||||
|
@ -117,7 +117,7 @@ def next():
|
||||||
id = playlist.get_next(cur_id)
|
id = playlist.get_next(cur_id)
|
||||||
if id != None:
|
if id != None:
|
||||||
cur_id = id
|
cur_id = id
|
||||||
return get_attrs("filepath")[0]
|
return all_attrs()["filepath"]
|
||||||
|
|
||||||
def list_source(list_func, *attrs):
|
def list_source(list_func, *attrs):
|
||||||
ret = []
|
ret = []
|
||||||
|
|
Loading…
Reference in New Issue