Skip to content

Commit

Permalink
spotify: small improvements, do not setup spotifyd by default
Browse files Browse the repository at this point in the history
  • Loading branch information
dezeroku committed May 19, 2024
1 parent bb69278 commit ffb0a86
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
9 changes: 4 additions & 5 deletions roles/spotify/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
spotify_email: "{{ user_email }}"
spotify_spotifyd_password_cmd: "rbw get -f password Spotify"
spotify_spotifyd_enable: false
spotify_spotifyd_password_cmd: "rbw get Spotify"
spotify_spotifyd_device_name: "spotifyd@{{ ansible_hostname }}"
spotify_spotifyd_bitrate: "160"
# TODO: better way for obtaining the home directory
# it must be an absolute path (readlink it?)
# as spotifyd does not support the placeholders like ~ or $HOME
spotify_spotifyd_cache_path: "{{ ansible_env.HOME }}/.cache/spotifyd"
# spotifyd doesn't not expand this variable, thus we need to do it here
spotify_spotifyd_cache_path: "{{ lookup('env', 'HOME') }}/.cache/spotifyd"
spotify_spotifyd_cache_size: "10000000000"
38 changes: 24 additions & 14 deletions roles/spotify/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,33 @@
name:
- spotify-launcher

- name: Ensure directory exists
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: 0755
loop:
- ~/.config/spotifyd
- "{{ spotify_spotifyd_cache_path }}"

- name: Template spotify-launcher config
ansible.builtin.template:
src: spotify-launcher.conf
dest: ~/.config/spotify-launcher.conf
mode: 0644

- name: Template spotifyd config
ansible.builtin.template:
src: spotifyd.conf
dest: ~/.config/spotifyd/spotifyd.conf
mode: 0644
- name: Set up spotifyd
when: spotify_spotifyd_enable
block:
- name: Install spotifyd
become: true
become_user: root
community.general.pacman:
name:
- spotifyd

- name: Ensure directory exists
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: 0755
loop:
- ~/.config/spotifyd
- "{{ spotify_spotifyd_cache_path }}"

- name: Template spotifyd config
ansible.builtin.template:
src: spotifyd.conf
dest: ~/.config/spotifyd/spotifyd.conf
mode: 0644

0 comments on commit ffb0a86

Please sign in to comment.