forked from nicokaiser/rpi-audio-receiver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-spotify.sh
executable file
·38 lines (30 loc) · 1 KB
/
install-spotify.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash -e
if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
echo
echo -n "Do you want to install Spotify Connect (Raspotify)? [y/N] "
read REPLY
if [[ ! "$REPLY" =~ ^(yes|y|Y)$ ]]; then exit 0; fi
read -p "Initial Volume when connecting from 0 to 100: " VAR_INIT_VOL
curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
PRETTY_HOSTNAME=$(hostnamectl status --pretty | tr ' ' '-')
PRETTY_HOSTNAME=${PRETTY_HOSTNAME:-$(hostname)}
cat <<EOF > /etc/raspotify/conf
LIBRESPOT_QUIET=
LIBRESPOT_AUTOPLAY=
LIBRESPOT_DISABLE_AUDIO_CACHE=
LIBRESPOT_DISABLE_CREDENTIAL_CACHE=
LIBRESPOT_ENABLE_VOLUME_NORMALISATION=
LIBRESPOT_NAME="${PRETTY_HOSTNAME}"
LIBRESPOT_DEVICE_TYPE="avr"
LIBRESPOT_BITRATE="320"
LIBRESPOT_INITIAL_VOLUME="${VAR_INIT_VOL}"
EOF
mkdir -p /etc/systemd/system/raspotify.service.d
cat <<'EOF' > /etc/systemd/system/raspotify.service.d/override.conf
[Unit]
Wants=pulseaudio.service
[Service]
SupplementaryGroups=pulse-access
EOF
systemctl daemon-reload
systemctl enable raspotify