Files
Bjarne Øverli 296722a201 Add initial plugins system based on GopherLua
Custom plugins can be added to the ~/.config/cliamp/plugins. Examples and docs added.
2026-03-29 19:39:40 +02: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)