Skip to content

brūhi Script Reference

brūhi Script is a sandboxed scripting language built into brūhi Desktop for dynamic playlist generation and automation. See brūhi Script for full documentation and worked examples.

ConstraintValue
Max execution time5 seconds
File system accessNone
Network accessNone
System callsNone

Query the content library.

MethodReturnsDescription
library.search(query)TrackListFull-text search. Accepts FTS5 query syntax.
library.genre(name)TrackListAll tracks where genre contains name (case-insensitive)
library.artist(name)TrackListAll tracks where artist contains name (case-insensitive)
library.recent(days)TrackListTracks added within the last N days
library.all()TrackListAll tracks in the library
SyntaxMeaningExample
wordAll fields contain wordjazz
"phrase"Exact phrase match"dark side"
field:valueMatch specific fieldgenre:rock
word1 word2Both words (AND)jazz blues
word1 OR word2Either wordjazz OR blues
^wordField starts with word^a (artists starting with A)
word*Prefix matchelectr*

Available field names: title, artist, album, genre

MethodReturnsDescription
.shuffle()TrackListFisher-Yates shuffle (in-place, returns self)
.limit(n)TrackListKeep first N tracks
.sort(field)TrackListSort by field: "title", "artist", "bpm", "year", "duration"
.reverse()TrackListReverse order
.append(list)TrackListAppend another TrackList

Methods can be chained:

library.genre("jazz").shuffle().limit(20)

Manage the active playlist.

MethodDescription
playlist.set(tracks)Replace the playlist with a TrackList
playlist.append(tracks)Append a TrackList to the current playlist
playlist.clear()Empty the playlist

Manage the upcoming track queue.

MethodDescription
queue.add(tracks)Add a TrackList to the end of the queue
queue.clear()Clear the queue

Control the playback decks.

MethodDescription
deck.a.load(track)Load a track onto Deck A
deck.b.load(track)Load a track onto Deck B
deck.a.play()Start playback on Deck A
deck.b.play()Start playback on Deck B
deck.a.pause()Pause Deck A
deck.b.pause()Pause Deck B
deck.a.stop()Stop Deck A
deck.b.stop()Stop Deck B

Read-only access to the current schedule state.

PropertyTypeDescription
schedule.currentBlock or nullCurrently active schedule block
schedule.nextBlock or nullNext upcoming schedule block
schedule.current.namestringName of the current block
schedule.current.ends_innumberSeconds until current block ends
library.genre("Pop").shuffle().limit(25)
library.genre("Rock").append(library.genre("Indie")).shuffle().limit(30)
library.recent(7).shuffle()
library.genre("EDM").sort("bpm")
library.search("title:live").sort("artist")
MessageCause
Script timed out after 5sScript took too long; reduce complexity or library size
Unknown method 'x' on TrackListTypo in method name
Cannot call library.search with 0 argumentsMissing query string
playlist.set requires a TrackListPassed wrong type (e.g., a string instead of a TrackList)
Invalid sort field 'x'Valid fields: title, artist, bpm, year, duration