Merge pull request #1382 from arisinfenix/song

song: print empty tags correctly
This commit is contained in:
dylan 2019-12-29 21:41:47 +00:00 committed by GitHub
commit 0b3e3a5968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 23 deletions

View File

@ -2601,11 +2601,9 @@ get_song() {
} }
case ${player/*\/} in case ${player/*\/} in
"mpd"*|"mopidy"*) song="$(mpc -f '%artist%\n%album%\n%title%' current "${mpc_args[@]}")" ;;
"mocp"*) song="$(mocp -Q '%artist \n%album \n%song')" ;; "mocp"*) song="$(mocp -Q '%artist \n%album \n%song')" ;;
"deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% \\n%album% \\n%title%')" ;; "deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% \\n%album% \\n%title%')" ;;
"xmms2d"*) song="$(xmms2 current -f "\${artist}"$'\n'"\${album}"$'\n'"\${title}")" ;; "qmmp"*) song="$(qmmp --nowplaying '%p \n%a \n%t')" ;;
"qmmp"*) song="$(qmmp --nowplaying '%p\\n%a\\n%t')" ;;
"gnome-music"*) get_song_dbus "GnomeMusic" ;; "gnome-music"*) get_song_dbus "GnomeMusic" ;;
"lollypop"*) get_song_dbus "Lollypop" ;; "lollypop"*) get_song_dbus "Lollypop" ;;
"clementine"*) get_song_dbus "clementine" ;; "clementine"*) get_song_dbus "clementine" ;;
@ -2632,18 +2630,19 @@ get_song() {
"plasma-browser-integration"*) get_song_dbus "plasma-browser-integration" ;; "plasma-browser-integration"*) get_song_dbus "plasma-browser-integration" ;;
"io.elementary.music"*) get_song_dbus "Music" ;; "io.elementary.music"*) get_song_dbus "Music" ;;
"mpd"* | "mopidy"*)
song="$(mpc -f '%artist% \n%album% \n%title%' current "${mpc_args[@]}")"
;;
"xmms2d"*)
song="$(xmms2 current -f "\${artist}"$' \n'"\${album}"$' \n'"\${title}")"
;;
"cmus"*) "cmus"*)
# NOTE: cmus >= 2.8.0 supports mpris2 # NOTE: cmus >= 2.8.0 supports mpris2
song="$(cmus-remote -Q | awk 'BEGIN { ORS=" "}; song="$(cmus-remote -Q | awk '/tag artist/ {$1=$2=""; a=$0}
/tag artist/ { /tag album / {$1=$2=""; b=$0}
$1=$2=""; sub(" ", ""); a=$0 /tag title/ {$1=$2=""; t=$0}
}
/tag album / {
$1=$2=""; sub(" ", ""); b=$0
}
/tag title/ {
$1=$2=""; sub(" ", ""); t=$0
}
END {print a " \n" b " \n" t}')" END {print a " \n" b " \n" t}')"
;; ;;