### Install go-librespot using Brew Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Install go-librespot on macOS and Linux using the Homebrew package manager. ```shell brew install go-librespot ``` -------------------------------- ### Build and Run go-librespot Daemon Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Build and run the go-librespot daemon from source after installing prerequisites. ```shell go run ./cmd/daemon ``` -------------------------------- ### Minimal Zeroconf Configuration Example Source: https://github.com/devgianlu/go-librespot/blob/master/README.md A minimal configuration for enabling Zeroconf mode with the Avahi backend. ```yaml zeroconf_enabled: true zeroconf_port: 0 zeroconf_backend: avahi credentials: type: zeroconf zeroconf: persist_credentials: false ``` -------------------------------- ### Install Libraries for Debian-based Systems Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Install necessary development libraries for building go-librespot on Debian-based systems like Ubuntu and Raspbian. ```shell sudo apt-get install libogg-dev libvorbis-dev libflac-dev libasound2-dev ``` -------------------------------- ### Generate Protobuf Definitions with Go Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Recompile protobuf definitions using Go's generate command. This command is part of the development setup for go-librespot. ```shell go generate ./... ``` -------------------------------- ### Generate Protobuf Definitions with Buf Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Recompile protobuf definitions using the Buf tool. This command is part of the development setup for go-librespot. ```shell buf generate ``` -------------------------------- ### Configure Zeroconf Backend via Command Line Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Set the Zeroconf backend to 'avahi' using a command-line flag. ```shell go-librespot -c zeroconf_backend=avahi ``` -------------------------------- ### Cross Compile Go Project Source: https://github.com/devgianlu/go-librespot/blob/master/CROSS_COMPILE.md Use this script to build the project for multiple platforms. Specify the target variant you want to build for. ```bash ./crosscompile.sh ``` -------------------------------- ### Configure Additional Settings Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Set various operational parameters for go-librespot, including logging, device information, audio backend, playback, and volume control. ```yaml log_level: info log_disable_timestamp: false device_id: '' device_name: '' device_type: computer audio_backend: alsa audio_backend_runtime_socket: '' audio_device: default mixer_device: '' mixer_control_name: Master audio_buffer_time: 500000 audio_period_count: 4 audio_output_pipe: '' audio_output_pipe_format: s16le bitrate: 160 volume_steps: 100 initial_volume: 100 ignore_last_volume: false external_volume: false disable_autoplay: false ``` -------------------------------- ### Enable API Server Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Configure the API server to control and monitor the player. Specify the enabled status, address, port, CORS policy, TLS certificates, and image size. ```yaml server: enabled: true address: localhost port: 3678 allow_origin: '' cert_file: '' key_file: '' image_size: 'default' ``` -------------------------------- ### Configure Interactive Mode Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Enable interactive mode for account association and discoverability. Set 'zeroconf_enabled' to false to disable constant discoverability. ```yaml zeroconf_enabled: false credentials: type: interactive ``` -------------------------------- ### Configure Audio Normalization Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Set up audio normalization to meet Spotify's -14 dB LUFS standard. Options include disabling normalization, using album gain, and applying a pregain. ```yaml normalisation_disabled: false normalisation_use_album_gain: false normalisation_pregain: 0 ``` -------------------------------- ### Websocket Events Source: https://github.com/devgianlu/go-librespot/blob/master/API.md The go-librespot API provides a Websocket endpoint at /events that emits various events related to playback and player state. These events include metadata, playback status, volume changes, and shuffle/repeat settings. ```APIDOC ## Websocket Endpoint: /events ### Description This endpoint provides real-time updates on player status and playback events. ### Events - **active**: The device has become active. - **inactive**: The device has become inactive. - **metadata**: A new track was loaded. Includes track details like URI, name, artist, album, and cover URL. - `context_uri`: The context URI - `uri`: Track URI - `name`: Track name - `artist_names`: List of track artist names - `album_name`: Track album name - `album_cover_url`: Track album cover image URL - `position`: Track position in milliseconds - `duration`: Track duration in milliseconds - **will_play**: The player is about to play the specified track. Includes context, track URI, and playback origin. - `context_uri`: The context URI - `uri`: The track URI - `play_origin`: Who started the playback - **playing**: The current track is playing. Includes context, track URI, resume status, and playback origin. - `context_uri`: The context URI - `uri`: The track URI - `resume`: Was this resumed from paused playback? - `play_origin`: Who started the playback - **not_playing**: The current track has finished playing. Includes context, track URI, and playback origin. - `context_uri`: The context URI - `uri`: The track URI - `play_origin`: Who started the playback - **paused**: The current track is paused. Includes context, track URI, and playback origin. - `context_uri`: The context URI - `uri`: The track URI - `play_origin`: Who started the playback - **stopped**: The current context is empty, nothing more to play. Includes playback origin. - `play_origin`: Who started the playback - **seek**: The current track was seeked. Includes context, track URI, position, duration, and playback origin. - `context_uri`: The context URI - `uri`: The track URI - `position`: Track position in milliseconds - `duration`: Track duration in milliseconds - `play_origin`: Who started the playback - **volume**: The player volume changed. Includes the current volume value and the maximum volume. - `value`: The volume, ranging from 0 to max - `max`: The max volume value - **shuffle_context**: The player shuffling context setting changed. Includes the new shuffle state. - `value`: Whether shuffling context is enabled - **repeat_context**: The player repeating context setting changed. Includes the new repeat state. - `value`: Whether repeating context is enabled - **repeat_track**: The player repeating track setting changed. Includes the new repeat state. - `value`: Whether repeating track is enabled ``` -------------------------------- ### Call Authorization Link Source: https://github.com/devgianlu/go-librespot/blob/master/README.md Use this command to complete the authentication flow if go-librespot is running on a different device than your browser. Replace 'xxxxxxxx' with your actual authorization code. ```bash curl http://127.0.0.1:36842/login?code=xxxxxxxx ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.