music: Set up ampswitch for MPD and Librespot
Some checks failed
Test / build (push) Failing after 55s
Some checks failed
Test / build (push) Failing after 55s
This commit is contained in:
parent
32b75696c2
commit
c784d4d217
4 changed files with 69 additions and 0 deletions
|
@ -75,3 +75,12 @@
|
||||||
name: skipbutton
|
name: skipbutton
|
||||||
state: restarted
|
state: restarted
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
|
- name: restart ampswitch
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: "ampswitch-{{ item }}"
|
||||||
|
state: restarted
|
||||||
|
daemon_reload: true
|
||||||
|
with_items:
|
||||||
|
- librespot
|
||||||
|
- mpd
|
||||||
|
|
34
roles/music/tasks/ampswitch.yaml
Normal file
34
roles/music/tasks/ampswitch.yaml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
- name: Install ampswitch depencies
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- libboost-dev
|
||||||
|
- libboost-dev
|
||||||
|
- nlohmann-json3-dev
|
||||||
|
|
||||||
|
- name: Install ampswitch service file
|
||||||
|
template:
|
||||||
|
src: ampswitch.service
|
||||||
|
dest: /etc/systemd/system/ampswitch-{{ item.instance }}.service
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0755
|
||||||
|
with_items:
|
||||||
|
- instance: mpd
|
||||||
|
pw_inputs:
|
||||||
|
- "Music Player Daemon:output_FL"
|
||||||
|
- "Music Player Daemon:output_FR"
|
||||||
|
- instance: librespot
|
||||||
|
pw_inputs:
|
||||||
|
- "librespot:out_0"
|
||||||
|
- "librespot:out_1"
|
||||||
|
notify: restart ampswitch
|
||||||
|
|
||||||
|
- name: Enable ampswitch
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: "ampswitch-{{ item }}"
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
with_items:
|
||||||
|
- librespot
|
||||||
|
- mpd
|
|
@ -40,3 +40,9 @@
|
||||||
file: soundboard.yaml
|
file: soundboard.yaml
|
||||||
tags:
|
tags:
|
||||||
- music_soundboard
|
- music_soundboard
|
||||||
|
|
||||||
|
- name: Ampswitch
|
||||||
|
ansible.builtin.import_tasks:
|
||||||
|
file: ampswitch.yaml
|
||||||
|
tags:
|
||||||
|
- music_ampswitch
|
||||||
|
|
20
roles/music/templates/ampswitch.service
Normal file
20
roles/music/templates/ampswitch.service
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Script hook for {{ item }} playback
|
||||||
|
After=network.target {{ item.instance }}.service
|
||||||
|
Requires={{ item.instance }}.service
|
||||||
|
StopPropagatedFrom={{ item.instance }}.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10s
|
||||||
|
ExecStart=/usr/bin/pw-jack ampswitch --jack-name ampswitch-{{ item.instance }} --on-command /opt/on-{{ item.instance }}-start.sh --switch-time 10 --trigger-level 0.001
|
||||||
|
ExecStartPost=/usr/bin/sleep 4
|
||||||
|
{% for pw_input in item.pw_inputs %}
|
||||||
|
ExecStartPost=-/usr/bin/pw-link "{{ pw_input }}" ampswitch-{{ item.instance }}:Input
|
||||||
|
{% endfor %}
|
||||||
|
User=root
|
||||||
|
Environment="XDG_RUNTIME_DIR=/run/user/{{ music_audio_user_id }}"
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Add table
Add a link
Reference in a new issue