xmordax.librespot

角色名称:Librespot

在支持systemd的arm64和armhf系统上安装和配置Librespot客户端。该角色还包括对Hifiberry设备的配置。如果您希望看到新功能,请随时创建新票据或提交PR来添加功能。

要求

仅适用于librespot-java类型的安装:

- src: geerlingguy.java
  version: 1.9.6
  name: java
  when: librespot_installation_type == "librespot-java"

角色变量

定义安装类型的变量:

librespot_installation_type: librespot # librespot的安装类型:librespot(rust),librespot-java,raspotify
raspotify_enable_hifiberry: "false" # 布尔值,如果你有hifiberry设备

对于raspotify类型安装的变量:

raspotify_device_name: "{{ ansible_hostname }}" # Spotify Connect上的设备名称
raspotify_bitrate: "320" # 比特率,96(低质量),160(默认质量)或320(高质量)
raspotify_options: "--zeroconf-port 40995" # 可以设置的librespot附加命令行参数
raspotify_cache_args: "" # 如果需要使用/var/cache/librespot作为缓存位置。默认情况下禁用缓存
raspotify_volume: "--enable-volume-normalisation --linear-volume --initial-volume=100" # 连接到客户端时的默认音量
raspotify_args: "--backend alsa --device default" # 后端可以在这里设置为pipe,但这仅用于非常高级的raspotify使用案例
raspotify_git_branch: "master" # 要从中构建的git分支/提交
raspotify_librespot_git_branch: "dev" # 要从librespot构建的git分支,如果想使用默认分支,请留空

对于本地librespot类型的安装变量:

librespot_device_name: "{{ ansible_hostname }}" # Spotify Connect上的设备名称
librespot_bitrate: "320" # 比特率,96(低质量),160(默认质量)或320(高质量)
librespot_options: "--zeroconf-port 40995" # 可以设置的librespot附加命令行参数
librespot_cache_args: "--disable-audio-cache" # 如果需要使用/var/cache/librespot作为缓存位置。默认情况下禁用缓存
librespot_volume: "--enable-volume-normalisation --linear-volume --initial-volume=100" # 连接到客户端时的默认音量
librespot_args: "--backend alsa" # 后端可以在这里设置为pipe,但这仅用于非常高级的使用案例
librespot_git_branch: "dev" # 要从中构建的git分支/提交

对于本地librespot-java类型的安装变量:

---

librespot_installation_type: librespot-java # librespot的安装类型:librespot(rust),librespot-java,raspotify
raspotify_enable_hifiberry: "false" # 布尔值,如果你有hifiberry设备

# raspotify
raspotify_device_name: "{{ ansible_hostname }}" # Spotify Connect上的设备名称
raspotify_bitrate: "320" # 比特率,96(低质量),160(默认质量)或320(高质量)
raspotify_options: "--zeroconf-port 40995" # 可以设置的librespot附加命令行参数
raspotify_cache_args: "" # 如果需要使用/var/cache/librespot作为缓存位置。默认情况下禁用缓存
raspotify_volume: "--enable-volume-normalisation --linear-volume --initial-volume=100" # 连接到客户端时的默认音量
raspotify_args: "--backend alsa --device default" # 后端可以在这里设置为pipe,但这仅用于非常高级的使用案例
raspotify_git_branch: "master" # 要从中构建的git分支/提交
raspotify_librespot_git_branch: "dev" # 要从librespot构建的git分支,如果想使用默认分支,请留空

# librespot
librespot_device_name: "{{ ansible_hostname }}" # Spotify Connect上的设备名称
librespot_bitrate: "320" # 比特率,96(低质量),160(默认质量)或320(高质量)
librespot_options: "--zeroconf-port 40995" # 可以设置的librespot附加命令行参数
librespot_cache_args: "--disable-audio-cache" # 如果需要使用/var/cache/librespot作为缓存位置。默认情况下禁用缓存
librespot_volume: "--enable-volume-normalisation --linear-volume --initial-volume=100" # 连接到客户端时的默认音量
librespot_args: "--backend alsa" # 后端可以在这里设置为pipe,但这仅用于非常高级的使用案例
librespot_git_branch: "dev" # 要从中构建的git分支/提交

# librespot-java
librespot_java_device_name: "{{ ansible_hostname }}" # Spotify Connect上的设备名称
librespot_java_device: "Computer" # 设备类型(计算机、平板、智能手机、扬声器、电视、AVR、STB、音频接收器、游戏机、视频投射、音频投射、汽车、可穿戴设备、未知、车载、未知)
librespot_java_preferred_locale: "Computer" # 首选语言环境
librespot_java_auth_strategy: "ZEROCONF" # 身份验证策略(USER_PASS, ZEROCONF, BLOB, FACEBOOK)
librespot_java_auth_username: "" # Spotify用户名(仅适用于BLOB和USER_PASS)
librespot_java_auth_password: "" # Spotify密码(仅适用于USER_PASS)
librespot_java_auth_blob: "" # Spotify身份验证blob(仅适用于BLOB)
librespot_java_zeroconf_port: 40995 # 监听该端口(`-1`表示随机)
librespot_java_zeroconf_listen_all: "true" # 在所有接口上监听(覆盖`zeroconf.interfaces`)
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" # 时间同步方法(NTP,PING,MELODY,手动)
librespot_java_time_manual_correction: 0 # 毫秒为单位的手动时间校正
librespot_java_player_autoplay_enabled: "true" # 当音乐结束时自动播放类似的歌曲
librespot_java_player_preferred_audio_quality: "VORBIS_320" # 首选音频质量(VORBIS_96,VORBIS_160,VORBIS_320)
librespot_java_player_normalisation_enable: "true" # 是否应用Spotify响度标准化
librespot_java_player_normalisation_pregain: 0.0 # 标准化前增益
librespot_java_player_initial_volume: 65536 # 初始音量(0-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" # 音频输出设备(MIXER,PIPE,STDOUT)
librespot_java_player_release_line_delay: 20 # 在设定的延迟后释放混音器线路(以秒为单位)
librespot_java_player_pipe: "" # 将原始(带符号)PCM输出到此文件(`player.output`必须为PIPE)
librespot_java_git_branch: "master" # 要从中构建的git分支/提交

依赖项

各个角色将在源机器上从源代码构建每个应用程序,然后将生成的工件推送到目标系统。因此,您的源机器必须满足构建项目所需的所有依赖项。

根据安装类型,请查看以下内容:

示例剧本

- hosts: all
  roles:
    - role: xmordax.librespot

Ansible指南

按请求,这里有一个快速的Ansible指南,以便您启动此项目。

  1. 在本地计算机上安装Ansible。
  2. 创建一个空的工作目录。
  3. 切换到新创建的目录并执行以下命令:ansible-galaxy install xmordax.librespot -p ./roles。 这将创建一个名为roles的文件夹,其中包含此存储库中的代码。
  4. 在工作目录的根目录下创建两个新文件:playbook.ymlinventory
  5. inventory文件中,需要编写连接到目标系统的配置。在我的例子中,我将使用SSH。如果您想使用其他身份验证方式,请查阅Ansible文档以了解如何配置您的库存文件。
    [server]
    hostname ansible_host=<目标机器的IP> ansible_user=<目标机器的用户> ansible_ssh_private_key_file=<SSH密钥的路径>
    
  6. playbook.yml文件用于配置您的部署,在我的例子中,我将进行基本配置以保持本指南简单。
    - hosts: server
      become: true
      roles:
        - librespot
    
      vars:
        # Raspotify配置
        librespot_installation_type: "librespot"
        raspotify_device_name: "home-spotify-connect"
    
  7. 使用以下命令进行部署:ansible-playbook playbook.yml -i inventory

重要提示

确保首先阅读本项目的依赖项部分。如果您在部署过程中遇到任何问题,请先参考官方Ansible文档,并尝试自行解决问题,然后再创建票据。

许可证

MIT / BSD

作者信息

该角色由Aljaz Gantar于2019年创建。

安装
ansible-galaxy install xmordax.librespot
许可证
mit
下载
110
拥有者