-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpmsd
More file actions
executable file
·55 lines (46 loc) · 1.22 KB
/
Copy pathpmsd
File metadata and controls
executable file
·55 lines (46 loc) · 1.22 KB
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
#!/bin/bash
sc () { echo $@ | socat - UNIX-CONNECT:/tmp/spotifyd 2>/dev/null; }
if [[ -n $(curl -s http://radio.53280.de 2>/dev/null | grep spotishare) ]]; then
if [[ "$(mpc current)" == "http://radio.53280.de/spotishare.ogg" ]]; then
echo "Stream already playing"
else
mpc clear
sleep 1
mpc add "http://nerd:radio@radio.53280.de/spotishare.ogg"
mpc play
fi
else
echo "Streaming Server not online"
fi
mainMenu () {
menu=("0: Exit pmsd"
"---"
"1. Add Song to Queue"
"2. Show Queue"
"3. Show current Track")
prompt() {
printf "%s\n" "$@" | rofi -dmenu -p "Select > "
}
case "$(prompt "${menu[@]}")" in
0:*) exit ;;
1.*) search ;;
2.*) showQueue ;;
3.*) showSong ;;
*) exit
esac
}
search () {
query="$(echo "Enter Search Term" | rofi -dmenu -p "> ")"
songlist="$(sc search ${query} | rofi -dmenu -p "Select Song to Add to Queue >")"
sc qadd "$(echo "$songlist" | awk -F " | " '{ print $1 }')"
pmsd
}
showQueue () {
sc qlist | rofi -dmenu -p "Current Queue > "
pmsd
}
showSong () {
sc cur_playing | rofi -dmenu -p "Current Song > "
pmsd
}
mainMenu