Back to Requiem

Lua plugins

Sandboxed LuaJIT scripts that add commands and change search, radio and playback.

Plugins are Lua scripts that run on LuaJIT. A plugin is one .lua file or a folder with a main.lua, and saving a file reloads it.

requiem.info{ name = "Hello", description = "My first plugin", version = "1.0" }

requiem.on("song", function(track)
  print("now playing: " .. track.artist .. " - " .. track.title)
end)

requiem.command("Say hi", function()
  requiem.toast("Hi from my plugin", "success")
end)

Safety

Sandbox: each plugin has its own Lua state, with io, ffi, require, dofile, loadfile, debug and most of os removed. Plugins save data through requiem.store and reach the web through requiem.http.

Errors: an error stops only the function it happened in.

Watchdog: a handler that runs longer than 200 ms is stopped with an error, which stops an endless loop from freezing the app. The watchdog runs plugins on LuaJIT's interpreter and not its JIT compiler.

What plugins can do

The Plugins page lists installed plugins with their state, errors, commands, settings and a console that stores the last 200 lines.

Searches, web requests, lyrics and link lookups run on separate threads, and the callback runs on the main thread with the result. The repo has example plugins that skip short songs, filter remixes out of search and post the current song to a webhook.