Merge pull request #571 from mstraube/song

Speed up song query for some players
This commit is contained in:
Dylan Araps 2016-12-28 00:42:33 +11:00 committed by GitHub
commit b22efefee3

View file

@ -1223,9 +1223,7 @@ get_song() {
"guayadeque"*) get_song_dbus "guayadeque" ;; "guayadeque"*) get_song_dbus "guayadeque" ;;
"cmus"*) "cmus"*)
artist="$(cmus-remote -Q | grep -F "tag artist ")" song="$(cmus-remote -Q | awk '/tag artist/ {$1=$2=""; print; print " - "} /tag title/ {$1=$2=""; print}')"
title="$(cmus-remote -Q | grep -F "tag title")"
song="${artist/tag artist} - ${title/tag title}"
;; ;;
"spotify"*) "spotify"*)
@ -1243,21 +1241,15 @@ get_song() {
;; ;;
"banshee"*) "banshee"*)
artist="$(banshee --query-artist | awk -F':' '{print $2}')" song="$(banshee --query-artist --query-title | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{if (a && t) print a " - " t}')"
title="$(banshee --query-title | awk -F':' '{print $2}')"
song="$artist - $title"
;; ;;
"amarok"*) "amarok"*)
artist="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {print $2}')" song="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{if (a && t) print a " - " t}')"
title="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/title/ {print $2}')"
song="$artist - $title"
;; ;;
"pragha"*) "pragha"*)
artist="$(pragha -c | awk -F':' '/artist/ {print $2}')" song="$(pragha -c | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{if (a && t) print a " - " t}')"
title="$(pragha -c | awk -F':' '/title/ {print $2}')"
song="$artist - $title"
;; ;;
"exaile"*) "exaile"*)