libsaria: on_like() callback
This replaces the LIKE event for setting if the user likes the current song.
This commit is contained in:
parent
69481ffa70
commit
99771a34fb
|
@ -14,3 +14,7 @@ def pause():
|
||||||
on_load = null_cb
|
on_load = null_cb
|
||||||
def load_file(file):
|
def load_file(file):
|
||||||
on_load(file)
|
on_load(file)
|
||||||
|
|
||||||
|
on_like = null_cb
|
||||||
|
def like_song(like):
|
||||||
|
on_like(like)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import prefs
|
import prefs
|
||||||
import audio
|
import audio
|
||||||
|
from libsaria import callbacks
|
||||||
libsaria = None
|
libsaria = None
|
||||||
sources = None
|
sources = None
|
||||||
library = None
|
library = None
|
||||||
|
@ -96,7 +97,8 @@ def set_rand(rand):
|
||||||
prefs.set("libsaria.random", rand)
|
prefs.set("libsaria.random", rand)
|
||||||
|
|
||||||
def set_like(like=None):
|
def set_like(like=None):
|
||||||
return call("SETLIKE", sources.set_attr, "like", like)
|
sources.set_attr("like", like)
|
||||||
|
callbacks.like_song(like)
|
||||||
|
|
||||||
def get_like():
|
def get_like():
|
||||||
return sources.get_attrs("like")
|
return sources.get_attrs("like")
|
||||||
|
|
|
@ -65,5 +65,5 @@ def on_load():
|
||||||
tiny.on_load()
|
tiny.on_load()
|
||||||
detailed.on_load()
|
detailed.on_load()
|
||||||
|
|
||||||
def on_like():
|
def on_like(like):
|
||||||
detailed.nowplaying.on_like()
|
detailed.nowplaying.on_like(like)
|
||||||
|
|
|
@ -62,8 +62,7 @@ def set_art(path):
|
||||||
height = 64
|
height = 64
|
||||||
ARTWORK.set_image(path, height)
|
ARTWORK.set_image(path, height)
|
||||||
|
|
||||||
def on_like():
|
def on_like(like):
|
||||||
like = controls.get_like()
|
|
||||||
def _on_like1(like):
|
def _on_like1(like):
|
||||||
LIKE.set_active(like == True)
|
LIKE.set_active(like == True)
|
||||||
DISLIKE.set_active(like == False)
|
DISLIKE.set_active(like == False)
|
||||||
|
|
|
@ -24,9 +24,9 @@ def on_load(file):
|
||||||
body.cur_page_goto()
|
body.cur_page_goto()
|
||||||
callbacks.on_load = on_load
|
callbacks.on_load = on_load
|
||||||
|
|
||||||
def on_like(*args):
|
def on_like(like):
|
||||||
footer.on_like()
|
footer.on_like(like)
|
||||||
invite("POSTSETLIKE", on_like)
|
callbacks.on_like = on_like
|
||||||
|
|
||||||
def on_getart(path, id):
|
def on_getart(path, id):
|
||||||
cur_id = libsaria.sources.get_attrs("id")
|
cur_id = libsaria.sources.get_attrs("id")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user