Liking cljdoc? Tell your friends :D

rockbox.core

Idiomatic Clojure SDK for Rockbox.

Quick start

(require '[rockbox.core :as rb]
         '[rockbox.playback :as pb]
         '[rockbox.library  :as lib])

(def client (rb/client))

;; Optional: open the WebSocket for real-time events
(rb/connect client)
(rb/on client :track-changed
  (fn [t] (println "▶" (:title t) "—" (:artist t))))

;; Look at what's playing
(when-let [t (pb/current-track client)]
  (println (:title t)))

;; Pipe-friendly: actions return the client so they compose
(-> client
    (pb/pause)
    (pb/seek 90000)
    (pb/resume))

Module map

DomainNamespace
Transport controlsrockbox.playback
Library / searchrockbox.library
Live queuerockbox.playlist
Saved playlistsrockbox.saved-playlists
Smart playlistsrockbox.smart-playlists
Volumerockbox.sound
Settingsrockbox.settings
System inforockbox.system
Filesystem browserrockbox.browse
Output devicesrockbox.devices
Bluetooth (Linux)rockbox.bluetooth
Real-time eventsrockbox.events
Plugin systemrockbox.plugin
Enums and helpersrockbox.types
Idiomatic Clojure SDK for [Rockbox](https://www.rockbox.org).

## Quick start

    (require '[rockbox.core :as rb]
             '[rockbox.playback :as pb]
             '[rockbox.library  :as lib])

    (def client (rb/client))

    ;; Optional: open the WebSocket for real-time events
    (rb/connect client)
    (rb/on client :track-changed
      (fn [t] (println "▶" (:title t) "—" (:artist t))))

    ;; Look at what's playing
    (when-let [t (pb/current-track client)]
      (println (:title t)))

    ;; Pipe-friendly: actions return the client so they compose
    (-> client
        (pb/pause)
        (pb/seek 90000)
        (pb/resume))

## Module map

| Domain                | Namespace                  |
|-----------------------|----------------------------|
| Transport controls    | `rockbox.playback`         |
| Library / search      | `rockbox.library`          |
| Live queue            | `rockbox.playlist`         |
| Saved playlists       | `rockbox.saved-playlists`  |
| Smart playlists       | `rockbox.smart-playlists`  |
| Volume                | `rockbox.sound`            |
| Settings              | `rockbox.settings`         |
| System info           | `rockbox.system`           |
| Filesystem browser    | `rockbox.browse`           |
| Output devices        | `rockbox.devices`          |
| Bluetooth (Linux)     | `rockbox.bluetooth`        |
| Real-time events      | `rockbox.events`           |
| Plugin system         | `rockbox.plugin`           |
| Enums and helpers     | `rockbox.types`            |
raw docstring

channelclj

See rockbox.events/channel.

See `rockbox.events/channel`.
sourceraw docstring

clientclj

(client)
(client {:keys [host port http-url ws-url timeout-ms headers http-client]})

Build a Rockbox client.

Options (all optional):

:host hostname or IP of rockboxd (default "localhost") :port GraphQL HTTP/WS port (default 6062) :http-url full HTTP URL override (overrides host/port) :ws-url full WebSocket URL override (overrides host/port) :timeout-ms request timeout in milliseconds (default 15000) :headers map of extra HTTP headers :http-client java.net.http.HttpClient instance to reuse

The returned value is a plain map — passable to all rockbox.* functions as their first argument so calls compose with ->.

(def c (rb/client))
(def c (rb/client {:host "music.home" :port 6062}))
(def c (rb/client {:http-url "https://music.home/graphql"}))
Build a Rockbox client.

Options (all optional):

  :host         hostname or IP of rockboxd        (default "localhost")
  :port         GraphQL HTTP/WS port              (default 6062)
  :http-url     full HTTP URL override            (overrides host/port)
  :ws-url       full WebSocket URL override       (overrides host/port)
  :timeout-ms   request timeout in milliseconds   (default 15000)
  :headers      map of extra HTTP headers
  :http-client  java.net.http.HttpClient instance to reuse

The returned value is a plain map — passable to all `rockbox.*` functions
as their first argument so calls compose with `->`.

    (def c (rb/client))
    (def c (rb/client {:host "music.home" :port 6062}))
    (def c (rb/client {:http-url "https://music.home/graphql"}))
sourceraw docstring

connectclj

(connect client)

Open the WebSocket and start the three default subscriptions (track / status / playlist). Idempotent. Returns the client.

Open the WebSocket and start the three default subscriptions
(track / status / playlist). Idempotent. Returns the client.
sourceraw docstring

default-hostclj

source

default-portclj

source

default-timeout-msclj

source

disconnectclj

(disconnect client)

Close the WebSocket connection. Returns the client.

Close the WebSocket connection. Returns the client.
sourceraw docstring

installed-pluginsclj

(installed-plugins client)

List installed plugins.

List installed plugins.
sourceraw docstring

offclj

See rockbox.events/off.

See `rockbox.events/off`.
sourceraw docstring

off-allclj

See rockbox.events/off-all.

See `rockbox.events/off-all`.
sourceraw docstring

onclj

See rockbox.events/on.

See `rockbox.events/on`.
sourceraw docstring

onceclj

See rockbox.events/once.

See `rockbox.events/once`.
sourceraw docstring

queryclj

(query client gql)
(query client gql vars)

Execute a raw GraphQL query/mutation. Returns the kebabized data map. Use this for operations not yet covered by the SDK.

(rb/query client "query { rockboxVersion }")
;=> {:rockbox-version "1.0.0"}

(rb/query client
          "query Album($id: String!) { album(id: $id) { id title } }"
          {:id "abc-123"})
Execute a raw GraphQL query/mutation. Returns the kebabized `data` map.
Use this for operations not yet covered by the SDK.

    (rb/query client "query { rockboxVersion }")
    ;=> {:rockbox-version "1.0.0"}

    (rb/query client
              "query Album($id: String!) { album(id: $id) { id title } }"
              {:id "abc-123"})
sourceraw docstring

unuse-pluginclj

(unuse-plugin client plugin-name)

Uninstall a plugin by name. Returns the client.

Uninstall a plugin by name. Returns the client.
sourceraw docstring

use-pluginclj

(use-plugin client plugin)

Install a plugin. See rockbox.plugin. Returns the client.

Install a plugin. See `rockbox.plugin`. Returns the client.
sourceraw docstring

with-headersclj

(with-headers c h)

Merge extra headers into c. Pipe-friendly.

Merge extra headers into `c`. Pipe-friendly.
sourceraw docstring

with-hostclj

(with-host c h)

Return c with :host set to h (and URLs rebuilt). Pipe-friendly.

Return `c` with `:host` set to `h` (and URLs rebuilt). Pipe-friendly.
sourceraw docstring

with-http-urlclj

(with-http-url c url)
source

with-portclj

(with-port c p)
source

with-timeoutclj

(with-timeout c ms)

Return c with :timeout-ms set. Pipe-friendly.

Return `c` with `:timeout-ms` set. Pipe-friendly.
sourceraw docstring

with-ws-urlclj

(with-ws-url c url)
source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close