song: add album for some players

pogo
exaile
quodlibet
pragha
amarok
deadbeef
qmmp
xmms2d
mocp
rhythmbox
banshee
mpd
This commit is contained in:
Michael Straube 2017-12-25 09:31:04 +01:00
parent 1f482d786c
commit 8ff013e734
1 changed files with 21 additions and 20 deletions

View File

@ -1428,13 +1428,13 @@ guayadeque|yarock|qmmp|quodlibet|deepin-music|tomahawk|pogo|elisa/ {printf $5 "
} }
case "${player/*\/}" in case "${player/*\/}" in
"mpd"* | "mopidy"*) song="$(mpc current)" ;; "mpd"* | "mopidy"*) song="$(mpc -f '%artist% - %album% - %title%' current)" ;;
"mocp"*) song="$(mocp -Q "%artist - %song")" ;; "mocp"*) song="$(mocp -Q "%artist - %album - %song")" ;;
"google play"*) song="$(gpmdp-remote current)" ;; "google play"*) song="$(gpmdp-remote current)" ;;
"rhythmbox"*) song="$(rhythmbox-client --print-playing)" ;; "rhythmbox"*) song="$(rhythmbox-client --print-playing-format '%ta - %at - %tt')" ;;
"deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% - %title%')" ;; "deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% - %album% - %title%')" ;;
"xmms2d"*) song="$(xmms2 current -f '${artist} - ${title}')" ;; "xmms2d"*) song="$(xmms2 current -f '${artist} - ${album} - ${title}')" ;;
"qmmp"*) song="$(qmmp --nowplaying '%p - %t')" ;; "qmmp"*) song="$(qmmp --nowplaying '%p - %a - %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" ;;
@ -1448,10 +1448,6 @@ guayadeque|yarock|qmmp|quodlibet|deepin-music|tomahawk|pogo|elisa/ {printf $5 "
"audacious"*) "audacious"*)
song="$(audtool current-song)" song="$(audtool current-song)"
# Remove Album from 'Artist - Album - Title'
#song="${song/-* -/-}"
[[ -z "$song" ]] && get_song_dbus "audacious" [[ -z "$song" ]] && get_song_dbus "audacious"
;; ;;
@ -1482,41 +1478,46 @@ guayadeque|yarock|qmmp|quodlibet|deepin-music|tomahawk|pogo|elisa/ {printf $5 "
;; ;;
"banshee"*) "banshee"*)
song="$(banshee --query-artist --query-title |\ song="$(banshee --query-artist --query-album --query-title |\
awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{print a " - " t}')" awk -F':' '/^artist/ {a=$2} /^album/ {b=$2} /^title/ {t=$2}
END{print a " - " b " - "t}')"
;; ;;
"amarok"*) "amarok"*)
song="$(qdbus org.kde.amarok /Player GetMetadata |\ song="$(qdbus org.kde.amarok /Player GetMetadata |\
awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{print a " - " t}')" awk -F':' '/^artist:/ {a=$2} /^album:/ {b=$2} /^title:/ {t=$2}
END{print a " - " b " - " t}')"
;; ;;
"pragha"*) "pragha"*)
song="$(pragha -c | awk -F':' '/^artist/ {a=$2} /^title/ {t=$2} END{print a " - " t}')" song="$(pragha -c | awk -F':' '/^artist/ {a=$2} /^album/ {b=$2} /^title/ {t=$2}
END{print a " - " b " - " t}')"
;; ;;
"exaile"*) "exaile"*)
song="$(dbus-send --print-reply --dest=org.exaile.Exaile /org/exaile/Exaile \ song="$(dbus-send --print-reply --dest=org.exaile.Exaile /org/exaile/Exaile \
org.exaile.Exaile.Query | awk -F':|,' '{if ($6 && $4) printf $6 " -" $4}')" org.exaile.Exaile.Query |
awk -F':|,' '{if ($6 && $8 && $4) printf $6 " -" $8 " -" $4}')"
;; ;;
"quodlibet"*) "quodlibet"*)
song="$(dbus-send --print-reply --dest=net.sacredchao.QuodLibet \ song="$(dbus-send --print-reply --dest=net.sacredchao.QuodLibet \
/net/sacredchao/QuodLibet net.sacredchao.QuodLibet.CurrentSong |\ /net/sacredchao/QuodLibet net.sacredchao.QuodLibet.CurrentSong |\
awk -F'"' '/artist/ {getline; a=$2} \ awk -F'"' '/artist/ {getline; a=$2} /album/ {getline; b=$2}
/title/ {getline; t=$2} END{print a " - " t}')" /title/ {getline; t=$2} END{print a " - " b " - " t}')"
;; ;;
"pogo"*) "pogo"*)
song="$(dbus-send --print-reply --dest=org.mpris.pogo /Player \ song="$(dbus-send --print-reply --dest=org.mpris.pogo /Player \
org.freedesktop.MediaPlayer.GetMetadata | org.freedesktop.MediaPlayer.GetMetadata |
awk -F'"' '/string "artist"/ {getline; a=$2} /string "title"/ {getline; t=$2} \ awk -F'"' '/string "artist"/ {getline; a=$2} /string "album"/ {getline; b=$2} \
END{print a " - " t}')" /string "title"/ {getline; t=$2} END{print a " - " b " - " t}')"
;; ;;
*) mpc >/dev/null 2>&1 && song="$(mpc current)" ;; *) mpc >/dev/null 2>&1 && song="$(mpc -f '%artist% - %album% - %title%' current)" ;;
esac esac
# TODO: adjust for album: "$(trim "$song")" == "- -"
[[ "$(trim "$song")" == "-" ]] && unset -v song [[ "$(trim "$song")" == "-" ]] && unset -v song
# Display Artist, Album and Title on separate lines. # Display Artist, Album and Title on separate lines.