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)
|
||||
|
||||
def get_like():
|
||||
return sources.get_attrs("like")
|
||||
return sources.all_attrs()["like"]
|
||||
|
||||
def load(file):
|
||||
file = expand(file)
|
||||
|
|
|
@ -9,7 +9,7 @@ import libsaria.xm as xml
|
|||
|
||||
add_child = xml.add_child
|
||||
add_text = xml.add_text
|
||||
get_attrs = libsaria.sources.get_attrs_id
|
||||
get_attrs = libsaria.sources.library.get_attrs
|
||||
file_id = path.file_id
|
||||
lib_file = "library"
|
||||
vers = "%s.%s" % (version.__major__, version.__minor__)
|
||||
|
|
|
@ -69,9 +69,9 @@ def lfm_cache_album(artist, album, title, file):
|
|||
return False
|
||||
|
||||
def get_album_art(file):
|
||||
id, artist, album, title = sources.get_attrs("id", "artist", "album", "title")
|
||||
file = cache.get_item(artist, album, title, "Folder.jpg", lfm_cache_album)
|
||||
callbacks.get_art(file, id)
|
||||
attrs = sources.all_attrs()
|
||||
file = cache.get_item(attrs["artist"], attrs["album"], attrs["title"], "Folder.jpg", lfm_cache_album)
|
||||
callbacks.get_art(file, attrs["id"])
|
||||
|
||||
def get_artwork(file):
|
||||
threading.Thread(target=get_album_art, args=(file,)).start()
|
||||
|
|
|
@ -13,8 +13,11 @@ import attrs
|
|||
attrs.load_dattrs()
|
||||
cur_id = None
|
||||
|
||||
def get_cur_id():
|
||||
return cur_id
|
||||
|
||||
def inc_count():
|
||||
attrs.inc_count(get_attrs("id")[0])
|
||||
attrs.inc_count(get_cur_id())
|
||||
|
||||
def find_attrs(file, *attr_list):
|
||||
if file == None:
|
||||
|
@ -78,9 +81,6 @@ def all_attrs():
|
|||
res["count"] = attrs.get_count("count")
|
||||
return res
|
||||
|
||||
def get_cur_id():
|
||||
return cur_id
|
||||
|
||||
def filter(text):
|
||||
visible = library.filter(text)
|
||||
playlist.set_visible(visible)
|
||||
|
@ -91,7 +91,7 @@ def is_visible(id):
|
|||
return library.is_visible(id)
|
||||
|
||||
def set_attr(attr, value):
|
||||
id = get_attrs("id")[0]
|
||||
id = get_cur_id()
|
||||
if id:
|
||||
attrs.set_dattr(id, attr, value)
|
||||
|
||||
|
@ -105,7 +105,7 @@ def make_library(path):
|
|||
def play_id(id):
|
||||
global cur_id
|
||||
cur_id = id
|
||||
file = get_attrs("filepath")[0]
|
||||
file = all_attrs()["filepath"]
|
||||
queue.rm_ids([id])
|
||||
libsaria.controls.load(file)
|
||||
libsaria.controls.play()
|
||||
|
@ -117,7 +117,7 @@ def next():
|
|||
id = playlist.get_next(cur_id)
|
||||
if id != None:
|
||||
cur_id = id
|
||||
return get_attrs("filepath")[0]
|
||||
return all_attrs()["filepath"]
|
||||
|
||||
def list_source(list_func, *attrs):
|
||||
ret = []
|
||||
|
|
Loading…
Reference in New Issue