Skip to content

Commit 1f37f5d

Browse files
authored
Merge pull request #67 from tomodachi/spotify_soloist_role
role for official headless spotify-connect client
2 parents 527bff3 + 050cc47 commit 1f37f5d

4 files changed

Lines changed: 89 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ by default in anonymous mode allowing anyone on your network to stream to your d
2424
| spotify_connect_name:| my-hifi | no |
2525

2626

27+
## spotify-soloist
28+
Installs & configures official spotify-connect compatible client
29+
by default in anonymous mode allowing anyone on your network to stream to your device
30+
31+
32+
| Variable name | Example | Mandatory |
33+
| -------------------- |:-------------:| :----------:|
34+
| spotify_soloist_api_key | | yes|
35+
| spotify_connect_name:| my-hifi | no |
36+
37+
2738
## roc_streaming
2839
Installs the roc sink modules for pulseaudio allowing streaming audio from
2940
any pulseaudio/pipewire sound server giving a apple air-share like streaming experience
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: Reload systemd
3+
become: false
4+
remote_user: media
5+
ansible.builtin.systemd:
6+
daemon_reload: true
7+
scope: user
8+
9+
- name: Restart Spotify soloist
10+
become: false
11+
remote_user: media
12+
ansible.builtin.systemd:
13+
service: spotify_soloist
14+
state: restarted
15+
scope: user
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
- name: Deduce OS architecture
3+
ansible.builtin.command: dpkg --print-architecture
4+
register: spotify_soloist_arch
5+
changed_when: false
6+
check_mode: false
7+
8+
- name: Fetch Spotify soloist
9+
ansible.builtin.get_url:
10+
url: https://soloist-builds.spotifycdn.com/soloist_release_{{ spotify_soloist_arch.stdout }}.tar.gz
11+
dest: /usr/local/bin/spotify_soloist.tar.gz
12+
owner: media
13+
group: media
14+
mode: '600'
15+
16+
- name: Unarchive spotify soloist
17+
ansible.builtin.unarchive:
18+
src: /usr/local/bin/spotify_soloist.tar.gz
19+
dest: /usr/local/bin/
20+
remote_src: true
21+
when: not ansible_check_mode
22+
23+
- name: Remove Spotify-soloist archive file
24+
ansible.builtin.file:
25+
path: /usr/local/bin/spotify_soloist.tar.gz
26+
state: absent
27+
when: not ansible_check_mode
28+
29+
- name: Create Spotify soloist service
30+
ansible.builtin.template:
31+
src: spotify_soloist.service.j2
32+
dest: /home/media/.config/systemd/user/spotify_soloist.service
33+
owner: media
34+
group: media
35+
mode: '600'
36+
notify: Reload systemd
37+
when: not ansible_check_mode
38+
tags: create_soloist_service
39+
40+
- name: Enable Spotify soloist service
41+
become: false
42+
remote_user: media
43+
ansible.builtin.systemd:
44+
name: spotify_soloist
45+
state: started
46+
enabled: true
47+
scope: user
48+
when: not ansible_check_mode
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=Spotifys official headless spotify-connect client
3+
Documentation=https://developer.spotify.com/documentation/soloist
4+
5+
After=network-online.target
6+
Wants=network-online.target
7+
8+
[Service]
9+
ExecStart=/usr/local/bin/soloist -k {{ spotify_soloist_api_key }} -n {% if spotify_connect_name is defined %}{{ spotify_connect_name }}{% else %}{{ inventory_hostname }}{% endif %}
10+
11+
Restart=always
12+
RestartSec=10
13+
14+
[Install]
15+
WantedBy=default.target

0 commit comments

Comments
 (0)