-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·53 lines (39 loc) · 871 Bytes
/
run.sh
File metadata and controls
executable file
·53 lines (39 loc) · 871 Bytes
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
URL="http://localhost/partytube"
if [ "$(id -u)" != "0" ]; then
echo "This script requires root" >&2
exit 1
fi
cd "$(dirname "$0")"
script_startup() {
sudo bash -c "screen -mdS http_collect /home/gbear/test/get_songs_http.sh $URL"
}
a=2
script_startup2() {
sudo ./get_songs_http.sh $URL&
a=$!
echo $a
}
script_shutdown() {
killall omxplayer
sudo kill $a
}
if ! [ -f "./url.png" ]; then
qrencode -o ./url.png -t PNG "$URL"
fi
trap "script_shutdown" EXIT SIGTERM
script_startup2
echo "Starting"
while [ 1 ]
do
echo "Showing playlist"
./show_playlist.py
clear
filename="$(ls -u ./output/ |grep -vie '\.JPG'$|tail -n1)"
if [ -n "$filename" ]; then
echo "Playing $filename"
node tweet.js $filename
omxplayer "./output/$filename" 2>/dev/null
ls ./output/ |grep "$filename" |xargs -n1 -i{} mv "./output/{}" "./archive"
fi
done