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.
Constraint Value Max execution time 5 seconds File system access None Network access None System calls None
Query the content library.
Method Returns Description 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
Syntax Meaning Example wordAll fields contain word jazz"phrase"Exact phrase match "dark side"field:valueMatch specific field genre:rockword1 word2Both words (AND) jazz bluesword1 OR word2Either word jazz OR blues^wordField starts with word ^a (artists starting with A)word*Prefix match electr*
Available field names: title, artist, album, genre
Method Returns Description .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.
Method Description 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.
Method Description queue.add(tracks)Add a TrackList to the end of the queue queue.clear()Clear the queue
Control the playback decks.
Method Description 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.
Property Type Description schedule.currentBlock or null Currently active schedule block schedule.nextBlock or null Next upcoming schedule block schedule.current.namestring Name of the current block schedule.current.ends_innumber Seconds 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")
Message Cause 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