Merge pull request #979 from dylanaraps/song_format

song: Added song_format.
This commit is contained in:
Dylan Araps 2018-05-09 23:48:15 +00:00 committed by GitHub
commit 158173b3c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 10 deletions

View File

@ -437,6 +437,16 @@ disk_subtitle="mount"
# yarock
music_player="auto"
# Format to display song information.
#
# Default: '%artist% - %album% - %title%'
# Values: '%artist%', '%album%', '%title%'
# Flag: --song_format
#
# Example:
# default: 'Song: Jet - Get Born - Sgt Major'
song_format="%artist% - %album% - %title%"
# Print the Artist and Title on separate lines
#
# Default: 'off'
@ -2486,18 +2496,20 @@ get_song() {
*) mpc >/dev/null 2>&1 && song="$(mpc -f '%artist% ‡ %album% ‡ %title%' current)" ;;
esac
[[ "$song" != *[a-z]* ]] && unset -v song
[[ "$song" != *[a-z]* ]] && { unset -v song; return; }
LC_ALL="$sys_locale" IFS="‡" read -r artist album title <<< "$song"
# Display Artist, Album and Title on separate lines.
if [[ "$song_shorthand" == "on" && "$song" ]]; then
LC_ALL="$sys_locale" IFS="‡" read -r artist album song <<< "$song"
if [[ "$song_shorthand" == "on" ]]; then
[[ "$(trim "$artist")" ]] && prin "Artist" "$artist"
[[ "$(trim "$album")" ]] && prin "Album" "$album"
[[ "$(trim "$song")" ]] && prin "Song" "$song"
[[ "$(trim "$song")" ]] && prin "Song" "$title"
else
song="${song_format/\%artist\%/${artist}}"
song="${song/\%album\%/${album}}"
song="${song/\%title\%/${title}}"
fi
song="${song//‡/-}"
}
get_resolution() {
@ -4678,7 +4690,8 @@ INFO:
'dir' shows the basename of the disks's path. (/, Local Disk, etc)
--ip_host url URL to query for public IP
--song_shorthand on/off Print the Artist/Title on separate lines
--song_format format Print the song data in a specific format (see config file).
--song_shorthand on/off Print the Artist/Album/Title on separate lines.
--music_player player-name Manually specify a player to use.
Available values are listed in the config file
--install_time on/off Enable/Disable showing the time in Install Date output.
@ -4835,6 +4848,7 @@ get_args() {
"--shell_path") shell_path="$2" ;;
"--shell_version") shell_version="$2" ;;
"--ip_host") public_ip_host="$2" ;;
"--song_format") song_format="$2" ;;
"--song_shorthand") song_shorthand="$2" ;;
"--music_player") music_player="$2" ;;
"--install_time") install_time="$2" ;;

View File

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH NEOFETCH "1" "May 2018" "Neofetch 3.4.1-git" "User Commands"
.TH NEOFETCH "1" "May 2018" "Neofetch 4.0.0-git" "User Commands"
.SH NAME
Neofetch \- A fast, highly customizable system info script
.SH SYNOPSIS
@ -115,8 +115,11 @@ Takes: name, mount, dir
\fB\-\-ip_host\fR url
URL to query for public IP
.TP
\fB\-\-song_format\fR format
Print the song data in a specific format (see config file).
.TP
\fB\-\-song_shorthand\fR on/off
Print the Artist/Title on separate lines
Print the Artist/Album/Title on separate lines.
.TP
\fB\-\-music_player\fR player\-name
Manually specify a player to use.