-
Notifications
You must be signed in to change notification settings - Fork 396
/
startup-scripts.sh
executable file
·52 lines (42 loc) · 1.77 KB
/
startup-scripts.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
#!/bin/bash
# The absolute path to the folder whjch contains all the scripts.
# Unless you are working with symlinks, leave the following line untouched.
PATHDATA="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
###########################################################
# Read global configuration file (and create is not exists)
# create the global configuration file from single files - if it does not exist
if [ ! -f $PATHDATA/../settings/global.conf ]; then
. /home/pi/RPi-Jukebox-RFID/scripts/inc.writeGlobalConfig.sh
fi
. $PATHDATA/../settings/global.conf
###########################################################
cat $PATHDATA/../settings/global.conf
echo
echo "${AUDIOVOLSTARTUP} is the mpd startup volume"
####################################
# make playists, files and folders
# and shortcuts
# readable and writable to all
sudo chmod -R 777 ${AUDIOFOLDERSPATH}
sudo chmod -R 777 ${PLAYLISTSFOLDERPATH}
sudo chmod -R 777 $PATHDATA/../shared/shortcuts
#########################################
# wait until mopidy/MPD server is running
STATUS=0
while [ "$STATUS" != "ACTIVE" ]; do STATUS=$(echo -e status\\nclose | nc -w 1 localhost 6600 | grep 'OK MPD'| sed 's/^.*$/ACTIVE/'); done
####################################
# check if and set volume on startup
/home/pi/RPi-Jukebox-RFID/scripts/playout_controls.sh -c=setvolumetostartup
####################
# play startup sound
mpgvolume=$((32768*${AUDIOVOLSTARTUP}/100))
echo "${mpgvolume} is the mpg123 startup volume"
/usr/bin/mpg123 -f -${mpgvolume} /home/pi/RPi-Jukebox-RFID/shared/startupsound.mp3
#######################
# re-scan music library
mpc rescan
#######################
# read out wifi config?
if [ "${READWLANIPYN}" == "ON" ]; then
/home/pi/RPi-Jukebox-RFID/scripts/playout_controls.sh -c=readwifiipoverspeaker
fi