Skip to content

Instantly share code, notes, and snippets.

@amanualt amanualt/art.sh
Created Dec 16, 2017

Embed
What would you like to do?
ncmpcpp
#!/bin/bash
#put this file to ~/.ncmpcpp/
MUSIC_DIR=/home/user/Music/ #path to your music dir
COVER=/tmp/cover.jpg
function reset_background
{
printf "\e]20;;100x100+1000+1000\a"
}
{
album="$(mpc --format %album% current)"
file="$(mpc --format %file% current)"
album_dir="${file%/*}"
[[ -z "$album_dir" ]] && exit 1
album_dir="$MUSIC_DIR/$album_dir"
covers="$(find "$album_dir" -type d -exec find {} -maxdepth 1 -type f -iregex ".*/.*\(${album}\|cover\|folder\|artwork\|front\).*[.]\(jpe?g\|png\|gif\|bmp\)" \; )"
src="$(echo -n "$covers" | head -n1)"
rm -f "$COVER"
if [[ -n "$src" ]] ; then
#resize the image's width to 300px
convert "$src" -resize 300x "$COVER"
if [[ -f "$COVER" ]] ; then
#scale down the cover to 30% of the original
printf "\e]20;${COVER};70x70+0+00:op=keep-aspect\a"
else
reset_background
fi
else
reset_background
fi
} &
% egrep -v '^#' .ncmpcpp/config
mpd_music_dir = "/home/user/Music/"
#mpd_host = "127.0.0.1"
#mpd_port = "6601"
mouse_list_scroll_whole_page = "yes"
lines_scrolled = "1"
visualizer_in_stereo = "no"
visualizer_fifo_path = "/tmp/mpd.fifo"
visualizer_output_name = "my_fifo"
visualizer_sync_interval = "10"
visualizer_type = "spectrum"
visualizer_look = "▋▋"
message_delay_time = "3"
playlist_shorten_total_times = "yes"
playlist_display_mode = "classic"
browser_display_mode = "columns"
search_engine_display_mode = "columns"
playlist_editor_display_mode = "columns"
autocenter_mode = "yes"
centered_cursor = "yes"
user_interface = "classic"
follow_now_playing_lyrics = "yes"
locked_screen_width_part = "60"
display_bitrate = "no"
external_editor = "nano"
main_window_highlight_color = "white"
progressbar_elapsed_color = "white"
progressbar_color = "black"
progressbar_look = "▃▃▃"
#progressbar_look = "─⊙ "
mouse_support = "yes"
header_visibility = "no"
statusbar_visibility = "no"
statusbar_color = "white"
visualizer_color = "white"
titles_visibility = "no"
enable_window_title = "yes"
now_playing_prefix = "$b"
now_playing_suffix = "$8$/b"
#now_playing_prefix = "$u$2"
#now_playing_suffix = "$2$/u$2"
song_columns_list_format = "(6)[]{} (23)[red]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}"
color1 = "white"
color2 = "black"
song_list_format = " $7%l $2%t $R$5%a "
#uncomment both statement's below if you want to display the albumart
#execute_on_song_change="~/.ncmpcpp/art.sh"
#song_list_format = " $2%t $R$5%a "
song_status_format = "$b$7♫ $2%a $4⟫$3⟫ $8%t $4⟫$3⟫ $5%b "
song_window_title_format = " {%a} - {%t}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.