l radio: set timeout for hooks, rename filter
This commit is contained in:
parent
00226d6e2a
commit
0bbbfe153a
@ -10,7 +10,7 @@ def stringify_attrs(attrs) =
|
|||||||
out
|
out
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_graveyard(req) =
|
def filter_music(req) =
|
||||||
filename = request.filename(req)
|
filename = request.filename(req)
|
||||||
if string.match(pattern = '.*/\\.graveyard/.*', filename) then
|
if string.match(pattern = '.*/\\.graveyard/.*', filename) then
|
||||||
false
|
false
|
||||||
@ -27,7 +27,7 @@ end
|
|||||||
env = environment()
|
env = environment()
|
||||||
port = string.to_int(env["RADIO_PORT"], default = 8000)
|
port = string.to_int(env["RADIO_PORT"], default = 8000)
|
||||||
|
|
||||||
all_music = playlist(env["MUSIC"], check_next = filter_graveyard)
|
all_music = playlist(env["MUSIC"], check_next = filter_music)
|
||||||
wishlist = request.queue()
|
wishlist = request.queue()
|
||||||
tracks = fallback(track_sensitive = true, [wishlist, all_music])
|
tracks = fallback(track_sensitive = true, [wishlist, all_music])
|
||||||
tracks = blank.eat(tracks)
|
tracks = blank.eat(tracks)
|
||||||
@ -36,7 +36,7 @@ last_metadata = ref([])
|
|||||||
def on_metadata(m) =
|
def on_metadata(m) =
|
||||||
last_metadata := m
|
last_metadata := m
|
||||||
print("changing tracks")
|
print("changing tracks")
|
||||||
out = process.read(env["HOOK_TRACK_CHANGE"], env = m)
|
out = process.read(env["HOOK_TRACK_CHANGE"], env = m, timeout = 5.0)
|
||||||
print(out)
|
print(out)
|
||||||
end
|
end
|
||||||
tracks.on_metadata(on_metadata)
|
tracks.on_metadata(on_metadata)
|
||||||
|
Loading…
Reference in New Issue
Block a user