From 8a96fd545d71041b61cef8c1e9aa220bdeeaea08 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 09:03:24 +0200 Subject: [PATCH 1/9] song: Fix issues with non-english tags --- neofetch | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index 455b744c..d71f4c0a 100755 --- a/neofetch +++ b/neofetch @@ -2467,22 +2467,28 @@ get_song() { /"title"/ {t=$4} END {print a "\n" b "\n" t}')" ;; - *) mpc &>/dev/null && song="$(mpc -f '%artist%\n%album%\n%title%' current)" ;; + *) mpc &>/dev/null && song="$(mpc -f '%artist%\n%album%\n%title%' current)" || return ;; esac - [[ "$song" != *[a-z]* ]] && { unset -v song; return; } - IFS=$'\n' read -d "" -r artist album title <<< "$song" + # Make sure empty tags are truly empty. + artist="$(trim "$artist")" + album="$(trim "$album")" + title="$(trim "$title")" + + # Set default values if no tags were found. + : "${artist:=Unknown Artist}" "${album:=Unknown Album}" "${title:=Unknown Song}" + # Display Artist, Album and Title on separate lines. if [[ "$song_shorthand" == "on" ]]; then - [[ "$(trim "$artist")" ]] && prin "Artist" "$artist" - [[ "$(trim "$album")" ]] && prin "Album" "$album" - [[ "$(trim "$song")" ]] && prin "Song" "$title" + prin "Artist" "$artist" + prin "Album" "$album" + prin "Song" "$title" else - song="${song_format/\%artist\%/${artist}}" - song="${song/\%album\%/${album}}" - song="${song/\%title\%/${title}}" + song="${song_format/\%artist\%/$artist}" + song="${song/\%album\%/$album}" + song="${song/\%title\%/$title}" fi } From 86711645a05f1f8f640d6b5a0c967d7f6f52b648 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 09:07:24 +0200 Subject: [PATCH 2/9] song: Fix issues with broken newlines --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index d71f4c0a..5c9096d1 100755 --- a/neofetch +++ b/neofetch @@ -2470,7 +2470,7 @@ get_song() { *) mpc &>/dev/null && song="$(mpc -f '%artist%\n%album%\n%title%' current)" || return ;; esac - IFS=$'\n' read -d "" -r artist album title <<< "$song" + IFS=$'\n' read -d "" -r artist album title <<< "${song//'\n'/$'\n'}" # Make sure empty tags are truly empty. artist="$(trim "$artist")" From c47826225e13838fdef85967bded870d30a3381b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 15:17:05 +0200 Subject: [PATCH 3/9] song: Added support for netease cloud music --- neofetch | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neofetch b/neofetch index 5c9096d1..f0f0d2da 100755 --- a/neofetch +++ b/neofetch @@ -2347,6 +2347,7 @@ get_song() { "mocp" "mopidy" "mpd" + "netease-cloud-music" "pogo" "pragha" "qmmp" @@ -2407,6 +2408,7 @@ get_song() { "dragon"*) get_song_dbus "dragonplayer" ;; "smplayer"*) get_song_dbus "smplayer" ;; "rhythmbox"*) get_song_dbus "rhythmbox" ;; + "netease-cloud-music"*) get_song_dbus "netease-cloud-music" ;; "cmus"*) song="$(cmus-remote -Q | awk 'BEGIN { ORS=" "}; From ae2384dca8f164fe76697109183d297c07ebc31f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 16:25:44 +0200 Subject: [PATCH 4/9] song: Fix deadbeef --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index f0f0d2da..d6e9e3ca 100755 --- a/neofetch +++ b/neofetch @@ -2386,7 +2386,7 @@ get_song() { "mpd"*|"mopidy"*) song="$(mpc -f '%artist%\n%album%\n%title%' current "${mpc_args[@]}")" ;; "mocp"*) song="$(mocp -Q '%artist\n%album\n%song')" ;; "google play"*) song="$(gpmdp-remote current)" ;; - "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')" ;; "gnome-music"*) get_song_dbus "GnomeMusic" ;; From 186093ddc089ea6adb6282f35ed12708831be4a7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 16:28:36 +0200 Subject: [PATCH 5/9] song: Fix qmmp --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index d6e9e3ca..490e6ff3 100755 --- a/neofetch +++ b/neofetch @@ -2388,7 +2388,7 @@ get_song() { "google play"*) song="$(gpmdp-remote current)" ;; "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" ;; "lollypop"*) get_song_dbus "Lollypop" ;; "clementine"*) get_song_dbus "clementine" ;; From faae04f0eec427cfdb5f97876bf1816cf62186e7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 16:39:56 +0200 Subject: [PATCH 6/9] song: Remove gpmdp-remote support as tool is unmaintained. --- neofetch | 1 - 1 file changed, 1 deletion(-) diff --git a/neofetch b/neofetch index 490e6ff3..cb48230e 100755 --- a/neofetch +++ b/neofetch @@ -2385,7 +2385,6 @@ get_song() { 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')" ;; - "google play"*) song="$(gpmdp-remote current)" ;; "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')" ;; From bbb06ad4a9fafa22952c3480fec935e5adb23c72 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 16:40:55 +0200 Subject: [PATCH 7/9] song: Remove gpmdp-remote support as tool is unmaintained. --- neofetch | 2 -- 1 file changed, 2 deletions(-) diff --git a/neofetch b/neofetch index cb48230e..0daa0367 100755 --- a/neofetch +++ b/neofetch @@ -429,7 +429,6 @@ disk_subtitle="mount" # exaile # gnome-music # gmusicbrowser -# Google Play # guayadeque # iTunes # juk @@ -2339,7 +2338,6 @@ get_song() { "exaile" "gnome-music" "gmusicbrowser" - "Google Play" "guayadeque" "iTunes" "juk" From 763f3a9af5fcf20dd24b2986648ea4e8b3c54374 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 17:09:29 +0200 Subject: [PATCH 8/9] song: Add netease to comment. --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 0daa0367..57a2856d 100755 --- a/neofetch +++ b/neofetch @@ -436,6 +436,7 @@ disk_subtitle="mount" # mocp # mopidy # mpd +# netease-cloud-music # pogo # pragha # qmmp From ee30f29da9476f12833003d569dded710ffecd15 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 17:16:18 +0200 Subject: [PATCH 9/9] song: Added config option to display music player --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 57a2856d..bcebeecf 100755 --- a/neofetch +++ b/neofetch @@ -76,6 +76,7 @@ print_info() { # info "Battery" battery # info "Font" font # info "Song" song + # [[ $player ]] && prin "Music Player" "$player" # info "Local IP" local_ip # info "Public IP" public_ip # info "Users" users