forked from xuancong84/pikaraoke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·41 lines (33 loc) · 967 Bytes
/
run.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
#!/usr/bin/env bash
session_name=PiKaraoke
cmds=("top"
#"sudo sh -c 'cp -f $HOME/.Xauthority ~ && PATH=$PATH python3 app.py -u $(whoami)'"
"PATH='$PATH' python3 app.py"
"PATH='$PATH' ./screencapture.sh -v -p 4000"
"PATH='$PATH' python3 vocal_splitter.py -p -d ~/pikaraoke-songs/"
#"pavucontrol"
)
if [ "`tmux ls | grep $session_name`" ]; then
echo "TMUX Session $session_name already exists!" >&2
exit 1
fi
export DISPLAY=:0
cd "`dirname $0`"
tmux new-session -s $session_name -d -x 240 -y 60
for i in `seq 0 $[${#cmds[*]}-1]`; do
sleep 0.2
tmux split-window
sleep 0.2
tmux select-layout tile
sleep 0.2
tmux send-keys -l "${cmds[i]}"
sleep 0.2
tmux send-keys Enter
done
# Set pulseaudio recording source
src="`pacmd list-sources | grep '.monitor>' | awk '{print $2}' | head -1 `"
idx="`pacmd list-source-outputs | grep index: | awk '{print $2}' | tail -1`"
if [ "$src" ]; then
pacmd move-source-output $idx "${src:1:-1}"
fi
tmux a -t $session_name