Skip to content

br\u016bhi Script

br\u016bhi Script is a minimal, sandboxed scripting language built into the Desktop app. Use it to write automation programs that are more expressive than the visual rule builder — for example, pulling tracks by multiple criteria, mixing sources, or computing queue logic.

Scripts run in a hard sandbox:

  • No file I/O — scripts cannot read or write files.
  • No network access — scripts cannot make HTTP requests or open sockets.
  • No system calls — scripts cannot launch processes or access the OS.
  • 5-second timeout — a script that runs longer than 5 seconds is killed automatically.

Scripts are safe to run on any user input. Error messages include the line number of the failure.

br\u016bhi Script is a simple expression language with shell-style comments and method chaining.

# This is a comment
# Assign a value
tracks = library.search("genre:Jazz")
# Method chaining
result = library.search("genre:Jazz").shuffle().limit(20)
# Set the playlist content
playlist.set(result)
  • Lines starting with # are comments.
  • Variables are dynamically typed.
  • Strings use double quotes.
  • There are no loops or conditionals — all logic is expressed via method chains.

Queries your media library.

MethodArgumentsReturnsDescription
search(query)StringTrackListFull-text search across title, artist, album, genre
genre(name)StringTrackListFilter by exact genre name
artist(name)StringTrackListFilter by exact artist name
recent(days)IntegerTrackListTracks added in the last N days
all()TrackListAll tracks in the library

Search query syntax:

PatternMatches
"jazz"Any field containing “jazz”
"genre:Jazz"Genre field exactly
"artist:Miles Davis"Artist field exactly
"bpm>120"BPM greater than 120
"duration<300"Duration less than 300 seconds

The result of any library query. All TrackList methods return a new TrackList, so they chain.

MethodArgumentsReturnsDescription
shuffle()TrackListFisher-Yates shuffle
limit(n)IntegerTrackListKeep only the first N tracks
sort(field)StringTrackListSort by "title", "artist", "bpm", "year", "duration", "added"
reverse()TrackListReverse the current order
append(other)TrackListTrackListConcatenate two track lists

Controls the smart playlist being defined (in Smart Playlist script mode) or the active playlist (in automation scripts).

MethodArgumentsDescription
set(tracks)TrackListReplace the playlist entirely with these tracks
append(tracks)TrackListAdd tracks to the end of the playlist
clear()Empty the playlist

Controls the broadcast queue for the active deck.

MethodArgumentsDescription
add(tracks)TrackListAppend tracks to the end of the queue
clear()Empty the queue

Controls the deck player (automation scripts only).

MethodArgumentsDescription
load(track)TrackLoad a single track to the active deck
play()Start playback
pause()Pause playback
stop()Stop and return to cue point

Reads the current schedule state (read-only).

Property / MethodReturnsDescription
schedule.current()Block or nullThe currently active schedule block
schedule.next()Block or nullThe next upcoming schedule block
tracks = library.search("genre:Jazz").shuffle().limit(30)
playlist.set(tracks)
fast = library.search("bpm>120").sort("bpm")
playlist.set(fast.limit(25))
rock = library.genre("Rock").shuffle().limit(8)
jazz = library.genre("Jazz").shuffle().limit(8)
blues = library.genre("Blues").shuffle().limit(4)
playlist.set(rock.append(jazz).append(blues).shuffle())
new_music = library.recent(14).sort("added").reverse()
older = library.all().sort("added")
playlist.set(new_music.append(older).limit(40))
# Used as a "Queue is empty" automation action
tracks = library.search("genre:Ambient").shuffle().limit(10)
queue.add(tracks)

The Script Editor is in the Schedule tab → Scripts section.

  • Create named scripts with +.
  • Edit in the monospace code editor.
  • Click Run to execute the script immediately.
  • Click Preview to evaluate the script and show which tracks would be affected, without making any changes.
  • Errors are shown in the error panel below the editor with line number and message.
  • Ctrl+S saves the script.
MessageMeaning
Timeout after 5000msThe script exceeded the 5-second limit
Unknown method 'xyz' on TrackListTypo in a method name
Expected string argumentWrong argument type passed to a method
Library search error: invalid queryMalformed search query string