Skip to content
Snippets Groups Projects
Verified Commit 6f2f1cda authored by Ole Binder's avatar Ole Binder
Browse files

Fix: Re-enable icy.update_metadata function

parent 419b2bba
No related branches found
No related tags found
1 merge request!17Yaml configuration file
Pipeline #7795 passed
......@@ -119,25 +119,11 @@ server.register(
)
so = []
# TODO: add all lineouts
so =
s0_enable ? list.add(("out_line_0", ("connected", "stream0")), so) : so
# so =
# s1_enable
# ? list.add(("out_line_1", ("connected", "#{s1_connected()}")), so) : so
# so =
# s2_enable
# ? list.add(("out_line_2", ("connected", "#{s2_connected()}")), so) : so
# so =
# s3_enable
# ? list.add(("out_line_3", ("connected", "#{s3_connected()}")), so) : so
# so =
# s4_enable
# ? list.add(("out_line_4", ("connected", "#{s4_connected()}")), so) : so
# lo = a1_out != '' ? list.add("out_line_1", lo) : lo
# lo = a2_out != '' ? list.add("out_line_2", lo) : lo
# lo = a3_out != '' ? list.add("out_line_3", lo) : lo
# lo = a4_out != '' ? list.add("out_line_4", lo) : lo
json_data = json()
json_data.add("line", lo_list())
json_data.add("stream", so)
......@@ -231,97 +217,50 @@ server.register(
fadeTo
)
# def icy_update(v) =
# # Parse the argument
# l = string.split(separator=",", v)
# def split(l, v) =
# v = string.split(separator="=", v)
# if
# list.length(v) >= 2
# then
# list.append(l, [(list.nth(v, 0, default=""), list.nth(v, 1, default=""))])
# else
# l
# end
# end
# meta = list.fold(split, [], l)
# # Update metadata
# if
# s0_enable == true
# then
# icy.update_metadata(
# mount=s0_mount,
# user=s0_user,
# password=s0_pass,
# host=s0_host,
# port=s0_port,
# meta
# )
# end
# if
# s1_enable == true
# then
# icy.update_metadata(
# mount=s1_mount,
# user=s1_user,
# password=s1_pass,
# host=s1_host,
# port=s1_port,
# meta
# )
# end
# if
# s2_enable == true
# then
# icy.update_metadata(
# mount=s2_mount,
# user=s2_user,
# password=s2_pass,
# host=s2_host,
# port=s2_port,
# meta
# )
# end
# TODO: reimplement this as list based approach
# if
# s3_enable == true
# then
# icy.update_metadata(
# mount=s3_mount,
# user=s3_user,
# password=s3_pass,
# host=s3_host,
# port=s3_port,
# meta
# )
# end
def icy_update(v) =
# Parse the argument
l = string.split(separator=",", v)
def split(l, v) =
v = string.split(separator="=", v)
if
list.length(v) >= 2
then
list.append(l, [(list.nth(v, 0, default=""), list.nth(v, 1, default=""))])
else
l
end
end
meta = list.fold(split, [], l)
# if
# s4_enable == true
# then
# icy.update_metadata(
# mount=s4_mount,
# user=s4_user,
# password=s4_pass,
# host=s4_host,
# port=s4_port,
# meta
# )
# end
# Update metadata
def update_metadata(stream) =
if
stream.enabled
then
icy.update_metadata(
mount=stream.mountpoint,
user=stream.user,
password=stream.password,
host=stream.host,
port=int_of_float(stream.port),
meta
)
end
end
# "OK"
# end
list.iter(update_metadata, config.stream)
"OK"
end
# server.register(
# "update",
# namespace="metadata",
# description=
# "Update metadata",
# usage=
# "update title=foo,album=bar, ...",
# icy_update
# )
\ No newline at end of file
server.register(
"update",
namespace="metadata",
description=
"Update metadata",
usage=
"update title=foo,album=bar, ...",
icy_update
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment