├── README.md ├── catalog.conf ├── cover.sh ├── cover_obs.sh ├── default_cover.png ├── tsession └── visualizer.conf /README.md: -------------------------------------------------------------------------------- 1 | # ncmpcpp-with-cover-art 2 | Setup for displaying cover art in ncmpcpp. 3 | 4 | ## Dependencies 5 | - `tmux` (to encapsulate everything in one window) 6 | - `inotify-tools` (for changing album art when switching songs) 7 | - `ueberzug` (for image rendering) 8 | - `ffmpeg` (used in scaling the album art) 9 | - `mpc` (cli client for MPD) 10 | 11 | ## Install 12 | Drop all the files in your `.ncmpcpp` directory and add this into your `.bashrc`: 13 | ``` 14 | alias music='tmux new-session -s $$ "tmux source-file ~/.ncmpcpp/tsession"' 15 | _trap_exit() { tmux kill-session -t $$; } 16 | ``` 17 | Set your `$MUSIC_DIR` env variable to contain your music directory. 18 | 19 | Run it with `music`. 20 | 21 | ## Screenshot 22 | ![alt text](https://radumirea.com/resources/blog/ncmcpp-with-album-art/ncmpcpp.png) 23 | -------------------------------------------------------------------------------- /catalog.conf: -------------------------------------------------------------------------------- 1 | visualizer_fifo_path = "/tmp/mpd.fifo" 2 | visualizer_output_name = "my_fifo" 3 | visualizer_sync_interval = "30" 4 | visualizer_in_stereo = "yes" 5 | visualizer_type = "spectrum" 6 | visualizer_look = ▮▮ 7 | system_encoding = "UTF-8" 8 | 9 | # Colors 10 | discard_colors_if_item_is_selected = "yes" 11 | header_window_color = "white" 12 | volume_color = "cyan" 13 | state_line_color = "green" 14 | state_flags_color = "red" 15 | main_window_color = "default" 16 | color1 = "default" 17 | color2 = "white" 18 | main_window_highlight_color = "red" 19 | progressbar_color = "black" 20 | progressbar_elapsed_color = "white" 21 | statusbar_color = "white" 22 | active_column_color = "red" 23 | 24 | # Bar 25 | song_status_format = "{%a - }{%t - }{%b}" 26 | progressbar_look = "▃▃▃" 27 | 28 | # General 29 | header_visibility = "no" 30 | statusbar_visibility = "no" 31 | execute_on_song_change = "~/.ncmpcpp/cover_obs.sh" 32 | -------------------------------------------------------------------------------- /cover.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "`ueberzug library`" 4 | 5 | COVER="/tmp/album_cover.png" 6 | 7 | function add_cover { 8 | ImageLayer::add [identifier]="img" [x]="2" [y]="1" [path]="$COVER" 9 | } 10 | 11 | ImageLayer 0< <( 12 | if [ ! -f "$COVER" ]; then 13 | cp "$HOME/.ncmpcpp/default_cover.png" "$COVER" 14 | fi 15 | while inotifywait -q -q -e close_write "$COVER"; do 16 | add_cover 17 | done 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /cover_obs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | COVER="/tmp/album_cover.png" 4 | EMB_COVER="/tmp/album_cover_embedded.png" 5 | COVER_SIZE="400" 6 | 7 | file="$MUSIC_DIR/$(mpc --format %file% current)" 8 | album="${file%/*}" 9 | err=$(ffmpeg -loglevel 16 -y -i "$file" -an -vcodec copy $EMB_COVER 2>&1) 10 | if [ "$err" != "" ]; then 11 | art=$(find "$album" -maxdepth 1 | grep -m 1 ".*\.\(jpg\|png\|gif\|bmp\)") 12 | else 13 | art=$EMB_COVER 14 | fi 15 | if [ "$art" = "" ]; then 16 | art="$HOME/.ncmpcpp/default_cover.png" 17 | fi 18 | ffmpeg -loglevel 0 -y -i "$art" -vf "scale=$COVER_SIZE:-1" "$COVER" 19 | 20 | -------------------------------------------------------------------------------- /default_cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/radumirea/ncmpcpp-with-cover-art/d8471dc419f8418ccb96728e07e85b1d41eeb855/default_cover.png -------------------------------------------------------------------------------- /tsession: -------------------------------------------------------------------------------- 1 | neww 2 | set -g status off 3 | 4 | send-keys "stty -echo" C-m 5 | send-keys "tput civis -- invisible" C-m 6 | send-keys "export PS1=''" C-m 7 | send-keys "clear" C-m 8 | send-keys "~/.ncmpcpp/cover.sh " C-m 9 | 10 | split-window -v 11 | select-pane -t 1 12 | send-keys "ncmpcpp --config='~/.ncmpcpp/catalog.conf'" C-m 13 | send-keys 1 14 | 15 | select-pane -t 0 16 | split-window -h 17 | send-keys "ncmpcpp --config='~/.ncmpcpp/visualizer.conf'" C-m 18 | send-keys 8 19 | send-keys u 20 | 21 | resize-pane -t 0 -x 49 -y 23 22 | resize-pane -t 1 -y 23 23 | 24 | set-hook client-resized 'resize-pane -t 0 -x 49 -y 23' 25 | 26 | select-pane -t 2 27 | -------------------------------------------------------------------------------- /visualizer.conf: -------------------------------------------------------------------------------- 1 | visualizer_fifo_path = "/tmp/mpd.fifo" 2 | visualizer_output_name = "my_fifo" 3 | visualizer_sync_interval = "30" 4 | visualizer_in_stereo = "yes" 5 | visualizer_type = "spectrum" 6 | visualizer_look = ▮▮ 7 | system_encoding = "UTF-8" 8 | 9 | mpd_music_dir = ~/music 10 | display_bitrate = no 11 | 12 | header_window_color = "white" 13 | volume_color = "cyan" 14 | state_line_color = "green" 15 | state_flags_color = "red" 16 | main_window_color = "default" 17 | color1 = "default" 18 | color2 = "white" 19 | main_window_highlight_color = "red" 20 | progressbar_color = "black" 21 | progressbar_elapsed_color = "white" 22 | statusbar_color = "white" 23 | active_column_color = "red" 24 | 25 | # Bar 26 | song_status_format = "{%a - }{%t - }{%b}" 27 | progressbar_look = " " 28 | 29 | # General 30 | header_visibility = "no" 31 | statusbar_visibility = "no" 32 | 33 | --------------------------------------------------------------------------------