-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup.sh
executable file
·73 lines (59 loc) · 1.55 KB
/
startup.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
set -x
set -e
echo "Preparing container..."
echo "SPOTIFY_NAME=$SPOTIFY_NAME"
echo "BACKEND_NAME=$BACKEND_NAME"
echo "DEVICE_NAME=$DEVICE_NAME"
echo "USER=$USER"
echo "PASS=$PASS"
DEVICE=""
BACKEND=""
VERB=""
USER=""
PASS=""
if [ "$VERBOSE" == "true" ]; then
VERB="-v"
fi
if [ "$BACKEND_NAME" != "" ]; then
BACKEND="--backend $BACKEND_NAME"
fi
if [ "$DEVICE_NAME" != "" ]; then
DEVICE="--device $DEVICE_NAME"
fi
if [ "$USER" != "" ]; then
USER="-u $USER"
fi
if [ "$PASS" != "" ]; then
PASS="-p $PASS"
fi
if [ "$DEVICE_NAME" == "equal" ]; then
if [ "$ALSA_SLAVE_PCM" == "" ]; then
echo "ALSA_SLAVE_PCM must be defined. eg. use 'plughw:0,0' for device at card 0, sub 0"
exit 1
fi
fi
echo "/etc/asound.conf"
envsubst < /asound.conf > /etc/asound.conf
cat /etc/asound.conf
echo ''
if [ "$EQUALIZATION" != "" ]; then
echo "Applying equalization $EQUALIZATION"
/equalizer.sh "$EQUALIZATION"
fi
set +e
if [ "$ALSA_SOUND_LEVEL" != "" ]; then
echo "Applying sound level to $ALSA_SOUND_LEVEL"
#TODO: enhance this logic
amixer cset numid=1 "$ALSA_SOUND_LEVEL"
amixer cset numid=2 "$ALSA_SOUND_LEVEL"
amixer cset numid=3 "$ALSA_SOUND_LEVEL"
amixer cset numid=4 "$ALSA_SOUND_LEVEL"
amixer cset numid=5 "$ALSA_SOUND_LEVEL"
amixer cset numid=6 "$ALSA_SOUND_LEVEL"
amixer cset numid=7 "$ALSA_SOUND_LEVEL"
amixer cset numid=8 "$ALSA_SOUND_LEVEL"
fi
set -e
echo "Starting Raspotify..."
/usr/bin/librespot $VERB --name "$SPOTIFY_NAME" $BACKEND $DEVICE $USER $PASS --bitrate 320 --disable-audio-cache --enable-volume-normalisation