Files
wehub-resource-sync ead81af521
CI / go (push) Waiting to run
CI / build (darwin, macos-14) (push) Waiting to run
CI / build (windows, windows-2025) (push) Waiting to run
Deploy to GitHub Pages / deploy (push) Failing after 0s
chore: import upstream snapshot with attribution
2026-07-13 12:31:13 +08:00

30 lines
761 B
Lua

-- webhook.lua — POST track info to a URL on every track change.
--
-- Configure the URL in config.toml:
-- [plugins.webhook]
-- url = "https://example.com/hook"
local p = plugin.register({
name = "webhook",
type = "hook",
description = "POST track info to a webhook URL",
})
local url = p:config("url")
p:on("track.change", function(track)
if not url then return end
local body, status = cliamp.http.post(url, {
json = {
title = track.title,
artist = track.artist,
album = track.album,
genre = track.genre,
path = track.path,
}
})
if status and status >= 400 then
cliamp.log.warn("webhook returned " .. tostring(status))
end
end)