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
  icy.update_metadata(
    mount="/mystream",
    password="hackme",
    host="myserver.net",
    meta
  )
  "Done !"
end

server.register(
  "update",
  namespace="metadata",
  description="Update metadata",
  usage="update title=foo,album=bar,..",
  icy_update
)
