-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext
executable file
·66 lines (50 loc) · 1.86 KB
/
next
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
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
editscript(){
local scriptpath script path swp; scriptpath=$(realpath "$0" 2>/dev/null); script="${scriptpath##*/}"; path="${scriptpath%/*}"; swp="$path/.$script.swp"
[[ ! -e "$swp" ]] && printf "\n\n%s\n\n" "$swp" && (/usr/bin/nano "$scriptpath") && exit
printf "\n%s is already being edited.\n%s exists; try fg or look in another window.\n" "$scriptpath" "$swp"; exit ;}
[[ "$1" == @(edit|e|-e) ]] && editscript
. mpdignore.functions
# bold="$(tput bold)"
# tput0="$(tput sgr0)"
# white="$(tput setaf 7)"
# red="$(tput setaf 1)"
brwhite="$(tput setaf 15)"
skcolor="$(tput setaf 1)"
crcolor="$(tput setaf 27)"
qucolor="$(tput setaf 3)"
xdgconfigset="$( . "$XDG_CONFIG_HOME/mpd-local.conf" 2>&1 >/dev/null )" || . "/home/$USER/.config/mpd-local.conf"
[[ "$xdgconfigset" =~ .+\ \/mpd-local.conf\:\ No\ such\ file\ or\ directory ]] &&
printf '\n%s[%sWARN%s] %s%s%s: check the definition of "$XDG_CONFIG_HOME"\n' \
"$bold" \
"$red" \
"$brwhite" \
"$(date -Im)" \
"$tput0" \
"$white"
pause(){ read -rp "$*" < /dev/tty; }
skip(){
logsong "skipped"
mpcp next
}
notify(){
source <(mpd-current.py)
output="$(notify-send -a "mpctitle next" -i audio-x-generic "Song Skipped!" "<b>$title</b> by <b>$artist</b>" 2>&1 )"
nserr="$?"
if [[ "$nserr" -ne 0 ]] && ! echo "$output" | grep -q "GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files"; then
echo "Error: $output"
fi
}
[[ "$1" = --set@(|-on) ]] && set -x && shift
[[ "$1" =~ ^x[[:digit:]]{1,2}$ ]] && count="${1#x}" && shift || count=1
for ((i=0; i<count; i++)); do
#get-current-json
source <(mpd-current.py)
# mpctitleout="$(/usr/local/bin/mpctitle "$@" &)"
logsong "skipped"&
hr2 "SKIPPED"
title skipped
notify
mpcp -q next &
done
/usr/local/bin/mpctitle --fromnext "$@"