xmordax.librespot
Role Name: Librespot
This guide explains how to install and set up the Librespot client on systems that use arm64 and armhf architecture and support systemd. It also covers how to configure a Hifiberry device. If you have suggestions for new features, please create a ticket or submit a pull request (PR) to contribute.
Requirements
This setup is specifically for the librespot-java
installation type:
- src: geerlingguy.java
version: 1.9.6
name: java
when: librespot_installation_type == "librespot-java"
Role Variables
Installation Type Variables
Define the installation type:
librespot_installation_type: librespot # Options: librespot (rust), librespot-java, raspotify
raspotify_enable_hifiberry: "false" # Set to "true" if you have a Hifiberry device
Raspotify Installation Variables:
raspotify_device_name: "{{ ansible_hostname }}" # Device name for Spotify Connect
raspotify_bitrate: "320" # Bitrate: 96 (low), 160 (default), 320 (high)
raspotify_options: "--zeroconf-port 40995" # Additional Librespot command line options
raspotify_cache_args: "" # Cache location, disabled by default
raspotify_volume: "--enable-volume-normalisation --linear-volume --initial-volume=100" # Default volume when connecting
raspotify_args: "--backend alsa --device default" # Backend settings
raspotify_git_branch: "master" # Git branch to build from
raspotify_librespot_git_branch: "dev" # Librespot git branch to use, empty for default
Native Librespot Installation Variables:
librespot_device_name: "{{ ansible_hostname }}" # Device name for Spotify Connect
librespot_bitrate: "320" # Bitrate options
librespot_options: "--zeroconf-port 40995" # Additional command line options
librespot_cache_args: "--disable-audio-cache" # Cache settings
librespot_volume: "--enable-volume-normalisation --linear-volume --initial-volume=100" # Default volume settings
librespot_args: "--backend alsa" # Backend settings
librespot_git_branch: "dev" # Git branch to build from
Native Librespot-java Installation Variables:
librespot_installation_type: librespot-java # Installation type
raspotify_enable_hifiberry: "false" # Hifiberry device flag
# Raspotify settings
raspotify_device_name: "{{ ansible_hostname }}"
raspotify_bitrate: "320"
raspotify_options: "--zeroconf-port 40995"
raspotify_cache_args: ""
raspotify_volume: "--enable-volume-normalisation --linear-volume --initial-volume=100"
raspotify_args: "--backend alsa --device default"
raspotify_git_branch: "master"
raspotify_librespot_git_branch: "dev"
# Librespot settings
librespot_device_name: "{{ ansible_hostname }}"
librespot_bitrate: "320"
librespot_options: "--zeroconf-port 40995"
librespot_cache_args: "--disable-audio-cache"
librespot_volume: "--enable-volume-normalisation --linear-volume --initial-volume=100"
librespot_args: "--backend alsa"
librespot_git_branch: "dev"
# Librespot-java specific settings
librespot_java_device_name: "{{ ansible_hostname }}"
librespot_java_device: "Computer" # Type of device
librespot_java_preferred_locale: "Computer" # Preferred locale
librespot_java_auth_strategy: "ZEROCONF" # Authentication method
librespot_java_auth_username: ""
librespot_java_auth_password: ""
librespot_java_auth_blob: ""
librespot_java_zeroconf_port: 40995
librespot_java_zeroconf_listen_all: "true"
librespot_java_zeroconf_interfaces: ""
librespot_java_cache_enabled: "true"
librespot_java_cache_dir: "./cache"
librespot_java_cache_do_clean_up: "true"
librespot_java_preload_enabled: "true"
librespot_java_time_synchronization_method: "NTP"
librespot_java_time_manual_correction: 0
librespot_java_player_autoplay_enabled: "true"
librespot_java_player_preferred_audio_quality: "VORBIS_320"
librespot_java_player_normalisation_enable: "true"
librespot_java_player_normalisation_pregain: 0.0
librespot_java_player_initial_volume: 65536
librespot_java_player_log_available_mixers: "false"
librespot_java_player_mixer_search_keywords: "plughw"
librespot_java_player_crossfade_duration: 0
librespot_java_timer_output: "MIXER"
librespot_java_player_release_line_delay: 20
librespot_java_player_pipe: ""
librespot_java_git_branch: "master"
Dependencies
This role builds applications from source on your source machine before sending the finished product to your target machine. Ensure your source machine has all the necessary dependencies for building these projects.
Refer to the links below based on your installation type:
Example Playbook
- hosts: all
roles:
- role: xmordax.librespot
Ansible Guide
Here's a quick guide for getting this project running with Ansible:
- Install Ansible on your local machine. Installation Guide
- Create an empty directory for the project.
- Navigate to the new directory and run the command:
ansible-galaxy install xmordax.librespot -p ./roles
This creates a folder called roles with the necessary code. - Create two files in your project directory:
playbook.yml
andinventory
. - In the
inventory
file, write your connection details:[server] hostname ansible_host=<IP_OF_TARGET_MACHINE> ansible_user=<USER_ON_TARGET_MACHINE> ansible_ssh_private_key_file=<PATH_TO_SSH_KEY>
- In the
playbook.yml
, configure your deployment:- hosts: server become: true roles: - librespot vars: librespot_installation_type: "librespot" raspotify_device_name: "home-spotify-connect"
- Deploy using:
ansible-playbook playbook.yml -i inventory
.
Important
Make sure to read the dependencies section before starting. If you encounter issues with deployment, refer to the Ansible Documentation for solutions before opening a ticket.
License
MIT / BSD
Author Information
This role was created in 2019 by Aljaz Gantar.