diff --git a/neofetch b/neofetch index 23a3ffa2..7742e91d 100755 --- a/neofetch +++ b/neofetch @@ -2392,18 +2392,18 @@ get_song() { 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/ {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}' )" } case "${player/*\/}" in - "mpd"* | "mopidy"*) song="$(mpc current)" ;; - "mocp"*) song="$(mocp -Q "%artist - %song")" ;; + "mpd"* | "mopidy"*) song="$(mpc -f '%artist% ‡ %album% ‡ %title%' current)" ;; + "mocp"*) song="$(mocp -Q "%artist ‡ %album ‡ %song")" ;; "google play"*) song="$(gpmdp-remote current)" ;; - "rhythmbox"*) song="$(rhythmbox-client --print-playing)" ;; - "deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% - %title%')" ;; - "xmms2d"*) song="$(xmms2 current -f '${artist} - ${title}')" ;; - "qmmp"*) song="$(qmmp --nowplaying '%p - %t')" ;; + "rhythmbox"*) song="$(rhythmbox-client --print-playing-format '%ta ‡ %at ‡ %tt')" ;; + "deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% ‡ %album% ‡ %title%')" ;; + "xmms2d"*) song="$(xmms2 current -f '${artist} ‡ ${album} ‡ ${title}')" ;; + "qmmp"*) song="$(qmmp --nowplaying '%p ‡ %a ‡ %t')" ;; "gnome-music"*) get_song_dbus "GnomeMusic" ;; "lollypop"*) get_song_dbus "Lollypop" ;; "clementine"*) get_song_dbus "clementine" ;; @@ -2417,16 +2417,15 @@ get_song() { "audacious"*) song="$(audtool current-song)" - - # Remove Album from 'Artist - Album - Title' - song="${song/-* -/-}" - - [[ -z "$song" ]] && get_song_dbus "audacious" + [[ -z "$song" || "$song_shorthand" == "on" ]] && get_song_dbus "audacious" ;; "cmus"*) - song="$(cmus-remote -Q | awk '/tag artist/ {$1=$2=""; print; print " - "}\ - /tag title/ {$1=$2=""; print}')" + song="$(cmus-remote -Q | awk 'BEGIN { ORS=" "}; + /tag artist/ {$1=$2=""; sub(" ", ""); a=$0}\ + /tag album / {$1=$2=""; sub(" ", ""); b=$0}\ + /tag title/ {$1=$2=""; sub(" ", ""); t=$0}\ + END { print a " ‡ " b " ‡ " t }')" ;; "spotify"*) @@ -2434,81 +2433,71 @@ get_song() { "Linux") get_song_dbus "spotify" ;; "Mac OS X") - song="$(osascript </dev/null 2>&1 && song="$(mpc current)" ;; + *) mpc >/dev/null 2>&1 && song="$(mpc -f '%artist% ‡ %album% ‡ %title%' current)" ;; esac - [[ "$(trim "$song")" == "-" ]] && unset -v song + [[ "$song" != *[a-z]* ]] && unset -v song - # Display Artist and Title on separate lines. + # Display Artist, Album and Title on separate lines. if [[ "$song_shorthand" == "on" && "$song" ]]; then - artist="${song/ -*}" - song="${song/*-}" + LC_ALL="$sys_locale" IFS="‡" read -r artist album song <<< "$song" - if [[ "$song" != "$artist" ]]; then - prin "Artist" "$artist" - prin "Song" "$song" - else - prin "$subtitle" "$song" - fi + [[ "$(trim "$artist")" ]] && prin "Artist" "$artist" + [[ "$(trim "$album")" ]] && prin "Album" "$album" + [[ "$(trim "$song")" ]] && prin "Song" "$song" fi + + song="${song//‡/-}" } get_resolution() {