libsaria: New library source callback
Triggered upon scanning a new path to add to the library.
This commit is contained in:
parent
bc54ef0a98
commit
e64f93ef39
|
@ -32,3 +32,7 @@ def get_art(file, id):
|
|||
on_load_playlist = null_cb
|
||||
def load_playlist():
|
||||
on_load_playlist()
|
||||
|
||||
on_new_source = null_cb
|
||||
def new_source():
|
||||
on_new_source()
|
||||
|
|
|
@ -201,13 +201,11 @@ def import_xml(file):
|
|||
|
||||
def import_library(child):
|
||||
attrs = xml.attributes(child)
|
||||
version = attrs.get("version", "1.1")
|
||||
version = float(attrs.get("version", "1.1"))
|
||||
print "Decoding library version: %s" % version
|
||||
if version == "1.1":
|
||||
if version == 1.1:
|
||||
decode_v1_1(child)
|
||||
elif version == "1.2":
|
||||
elif version == 1.2:
|
||||
decode_v1_2(child)
|
||||
elif version == "1.3":
|
||||
decode_v1_3(child)
|
||||
elif version == "4.4": # No library format change from 1.3
|
||||
elif version >= 1.3:
|
||||
decode_v1_3(child)
|
||||
|
|
|
@ -55,7 +55,8 @@ def new_source(path, bg=True):
|
|||
path = expand(path)
|
||||
if not exists(path):
|
||||
return 0
|
||||
return call("NEWSOURCE", library.scan, path)
|
||||
library.scan(path)
|
||||
libsaria.callbacks.new_source()
|
||||
|
||||
def play_id(id):
|
||||
library.play_id(id)
|
||||
|
|
|
@ -10,11 +10,11 @@ import library
|
|||
|
||||
invite = libsaria.event.invite
|
||||
|
||||
def on_play(*args):
|
||||
def on_play():
|
||||
footer.on_play()
|
||||
callbacks.on_play = on_play
|
||||
|
||||
def on_pause(*args):
|
||||
def on_pause():
|
||||
footer.on_pause()
|
||||
callbacks.on_pause = on_pause
|
||||
|
||||
|
@ -36,10 +36,10 @@ def on_get_art(path, id):
|
|||
footer.set_art(path)
|
||||
callbacks.on_get_art = on_get_art
|
||||
|
||||
def on_load_playlist(*args):
|
||||
def on_load_playlist():
|
||||
playlist.refresh()
|
||||
callbacks.on_load_playlist = on_load_playlist
|
||||
|
||||
def on_load_library(*args):
|
||||
def on_load_library():
|
||||
library.refresh()
|
||||
invite("POSTNEWSOURCE", on_load_library)
|
||||
callbacks.on_new_source = on_load_library
|
||||
|
|
Loading…
Reference in New Issue