cmus now works with only 1 call for entire block
This commit is contained in:
parent
8d88fe172e
commit
e2e74f1de3
17
neofetch
17
neofetch
|
@ -1452,18 +1452,13 @@ getsong () {
|
||||||
state=$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}' 2>/dev/null)
|
state=$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}' 2>/dev/null)
|
||||||
|
|
||||||
elif [ -n "$(ps x | awk '!(/awk/) && /cmus/')" ]; then
|
elif [ -n "$(ps x | awk '!(/awk/) && /cmus/')" ]; then
|
||||||
song="$(cmus-remote -Q | grep "tag artist \|title" 2>/dev/null | tr -d '\012')"
|
IFS=$'\n'
|
||||||
if [ "$(printf "$song" | awk '{print $2}')" == "title" ]; then
|
song=($(cmus-remote -Q | grep "tag artist \|title \|status" 2>/dev/null | sort))
|
||||||
artist="${song##*tag artist }"
|
artist=${song[1]/tag artist }
|
||||||
title="${song##*tag title }"
|
title=${song[2]/tag title }
|
||||||
title="${title%%tag artist*}"
|
state=${song[0]/status }
|
||||||
else
|
|
||||||
artist="${song##tag artist }"
|
|
||||||
artist="${artist%%tag title*}"
|
|
||||||
title="${song##*tag title }"
|
|
||||||
fi
|
|
||||||
song="$artist - $title"
|
song="$artist - $title"
|
||||||
state=$(cmus-remote -Q | awk -F ' ' '/status/ {printf $2}' 2>/dev/null)
|
|
||||||
|
|
||||||
elif pgrep "mocp" >/dev/null 2>&1; then
|
elif pgrep "mocp" >/dev/null 2>&1; then
|
||||||
song="$(mocp -Q "%artist - %song" 2>/dev/null)"
|
song="$(mocp -Q "%artist - %song" 2>/dev/null)"
|
||||||
|
|
Reference in New Issue