From ca8c45b66837c6f80e4f08e5421c2c0422407183 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 15 Dec 2016 23:29:34 +1100 Subject: [PATCH] Song: Remove duplicate blocks --- neofetch | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/neofetch b/neofetch index 03dfc20f..11986ed0 100755 --- a/neofetch +++ b/neofetch @@ -1219,32 +1219,16 @@ get_song() { song="$(audtool current-song)" ;; - "gnome-music"*) + "gnome-music"* | "lollypop"* | "clementine"*) + case "$player" in + "gnome-music"*) player="GnomeMusic" ;; + "lollypop"*) player="Lollypop" ;; + "clementine"*) player="clementine" ;; + esac + # Hello dbus my old friend. song="$(\ - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.GnomeMusic /org/mpris/MediaPlayer2 \ - org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\ - awk -F 'string "' '/string|array/ {printf "%s",$2; next}{print ""}' |\ - awk -F '"' '/artist|title/ {printf $2 " - "}' - )" - song="${song% - }" - ;; - - "lollypop"*) - # Hello dbus my old friend. - song="$(\ - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.Lollypop /org/mpris/MediaPlayer2 \ - org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\ - awk -F 'string "' '/string|array/ {printf "%s",$2; next}{print ""}' |\ - awk -F '"' '/artist|title/ {printf $2 " - "}' - )" - song="${song% - }" - ;; - - "clementine"*) - # dbus - song="$( - dbus-send --print-reply --dest=org.mpris.clementine /org/mpris/MediaPlayer2 \ + dbus-send --print-reply --dest=org.mpris.MediaPlayer2."${player}" /org/mpris/MediaPlayer2 \ org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\ awk -F 'string "' '/string|array/ {printf "%s",$2; next}{print ""}' |\ awk -F '"' '/artist|title/ {printf $2 " - "}'