Skip to content

Nari APIs

Nari’s autoloads are globals in Lua. These are the parts plugins use the most; see Talking to Godot for how calls, signals and values work.

Call
:play(song_id), :toggle(), :next(), :previous(), :seek(ms) Playback.
:play_tracks(tracks, song_id, shuffled) Plays a list of songs, from song_id (or the first one), optionally shuffled.
:play_uri(song) Plays one song from its own uri (URL, path or scheme:id), whatever the music provider is. { id, title, artist, album, uri, live = true } for a radio.
:set_equalizer(bands) An equalizer for everything Nari plays: a list of Vector2(frequency_hz, gain_db), up to 16 bands, gains from -24 to 24 dB. {} turns it off. It keeps working in the background.
:shuffle(on), MediaPlayer["repeat"](MediaPlayer, mode) repeat is a Lua keyword, hence the brackets. Modes: MediaPlayer.Repeat.OFF, ALL, ONE.
:is_playing(), :get_position(), :get_duration() Playback state.
:get_current_song(), :get_playback_state(), :get_queue() The current song, the full state, the queue.
:add_to_queue(id), :play_next(id) The queue.
:is_liked(kind, id), :set_liked(kind, item, liked), :toggle_like(kind, item), :get_liked(kind) Likes of track, album or artist. Liked songs are also the “Liked songs” playlist (id liked).
:get_history(limit), :get_top(kind, limit) Listening history, newest first, and the most played track, album or artist (with plays).
:get_tracks(), :get_albums(), :get_artists(), :get_song(id), :get_album(id), :get_artist(id), :get_playlists() The library. Async, use nari.await.
.playback_changed, .current_song_changed, .library_changed, .playlists_changed Signals.
.likes_changed(kind, id, liked) Signal. kind is empty after the provider’s likes are loaded.
Call
:change_page(Main.Pages.Albums, data) Opens a screen.
:go_back(), :go_home(), :open_now_playing() Navigation.
:get_page(), .current_page, .current_data The current screen.
:set_hints(list) Controller hints at the bottom: { glyph = InputGlyphs.Glyph.A, text = "Select", icon = texture }.
.dual, .reduce_motion Whether dual-screen mode and reduced motion are on.
.page_changed Signal.

:get_color(ThemeEngine.Colors.X) gives a color of the current theme, where X is one of Background, BackgroundTint, Foreground, PanelBg, PanelFg, AccentBg, AccentFg, AccentGradient, SuccessBg, WarningBg, ErrorBg, RedBg, GreenBg, BlueBg, YellowBg, PurpleBg, GrayBg or Transparent. Each color also has Fg and Gradient variants.

:follow(node, handler) calls handler every time the theme changes.

:get_value(section, key, fallback) reads any setting, and the .changed(section, key, value) signal fires when one changes.

:is_enabled(id), .manifests and the .plugins_changed signal.

:pick_text(extensions) lets the user pick a text file (up to 4 MiB) and gives its contents, "" when nothing was picked. It’s async:

nari.await(Plugins:pick_text({ "txt" }), function(text) end)

On Android the extensions aren’t enforced.