-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmzstream_backend.sh
executable file
·45 lines (40 loc) · 1.16 KB
/
mzstream_backend.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
#!/bin/bash
source ~/.mzstream
cd $(dirname $(readlink -f $0))
remove_file () {
[ -e $1 ] && rm $1
}
kill_process () {
count=$(ps -aux | grep $1 | wc -l)
if [[ "$count" != "1" ]]; then
killall $1
fi
}
remove_file web/run.txt
kill_process mzstream.sh
kill_process ffmpeg
python http.py $WEBUI_PORT &
while :
do
[ ! -e web/drivers.json ] && ./listinterfaces.sh
sleep 1
count=$(ps -aux | grep mzstream.sh | wc -l)
if [[ -e web/run.txt ]]; then
if [[ "$count" == "1" ]]; then
echo run
audio=$(cat web/config.json | grep audio_id | cut -d: -f2 | tr -d ',' | tr -d '"')
capture=$(cat web/config.json | grep capture_id | cut -d: -f2 | tr -d ',' | tr -d '"')
webcam=$(cat web/config.json | grep webcam_id | cut -d: -f2 | tr -d ',' | tr -d '"')
val_x=$(cat web/config.json | grep val_x | cut -d: -f2 | tr -d ',' | tr -d '"')
val_y=$(cat web/config.json | grep val_y | cut -d: -f2 | tr -d ',' | tr -d '"')
./mzstream.sh $capture $webcam $audio $val_x $val_y $TWITCH_URL &
fi
sleep 5
else
if [[ "$count" != "1" ]]; then
echo stop
kill_process mzstream.sh
kill_process ffmpeg
fi
fi
done