ncmpcpp: add config, bindings and a script
This commit is contained in:
parent
7602ff75b4
commit
730f20af52
38
dot_config/ncmpcpp/bindings
Normal file
38
dot_config/ncmpcpp/bindings
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
##############################################################
|
||||||
|
## My `ncmpcpp` keybindings. This file should be in ##
|
||||||
|
## ~/.ncmpcpp/bindings or $XDG_CONFIG_HOME/ncmpcpp/bindings ##
|
||||||
|
## ##
|
||||||
|
## For more information, see example file ##
|
||||||
|
## -> /usr/share/doc/ncmpcpp/bindings ##
|
||||||
|
##############################################################
|
||||||
|
#
|
||||||
|
# vim-like bindings
|
||||||
|
def_key "l"
|
||||||
|
next_column
|
||||||
|
def_key "h"
|
||||||
|
previous_column
|
||||||
|
def_key "j"
|
||||||
|
scroll_down
|
||||||
|
def_key "k"
|
||||||
|
scroll_up
|
||||||
|
|
||||||
|
def_key "."
|
||||||
|
seek_forward
|
||||||
|
def_key ","
|
||||||
|
seek_backward
|
||||||
|
def_key ">"
|
||||||
|
next
|
||||||
|
def_key "<"
|
||||||
|
previous
|
||||||
|
|
||||||
|
def_key "ctrl-l"
|
||||||
|
seek_forward
|
||||||
|
def_key "ctrl-h"
|
||||||
|
seek_backward
|
||||||
|
def_key "ctrl-p"
|
||||||
|
volume_up
|
||||||
|
def_key "ctrl-n"
|
||||||
|
volume_down
|
||||||
|
|
||||||
|
def_key ";"
|
||||||
|
show_lyrics
|
2
dot_config/ncmpcpp/config
Normal file
2
dot_config/ncmpcpp/config
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ncmpcpp_directory=~/.config/ncmpcpp
|
||||||
|
lyrics_directory=~/.config/ncmpcpp/lyrics
|
66
dot_config/ncmpcpp/executable_art.sh
Normal file
66
dot_config/ncmpcpp/executable_art.sh
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Add following line to config:
|
||||||
|
# execute_on_song_change = "~/.config/ncmpcpp/art.sh"
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------#
|
||||||
|
# Generate current song cover #
|
||||||
|
# ffmpeg version #
|
||||||
|
#-------------------------------#
|
||||||
|
|
||||||
|
# Path to music directory
|
||||||
|
MUSIC_DIR="$HOME/.local/share/mpd/music"
|
||||||
|
# Path to output cover
|
||||||
|
COVER="/tmp/cover.png"
|
||||||
|
COVER_NOTIFICATION="/tmp/cover_notification.png"
|
||||||
|
# Size of cover
|
||||||
|
COVER_SIZE=297
|
||||||
|
# Size in pixel of borders to crop out
|
||||||
|
CROP_BORDER=20
|
||||||
|
# Radius or rounded borders
|
||||||
|
BORDER_RADIUS=10
|
||||||
|
|
||||||
|
ffmpeg_cover() {
|
||||||
|
ffmpeg -loglevel 0 -y -i "$1" -vf "crop=min(in_w-$CROP_BORDER\,in_h-$CROP_BORDER):out_w,scale=-2:$COVER_SIZE" "$COVER"
|
||||||
|
}
|
||||||
|
|
||||||
|
rounded_cover() {
|
||||||
|
convert -quiet "$COVER" \
|
||||||
|
\( +clone -alpha extract \
|
||||||
|
-draw "fill black polygon 0,0 0,$BORDER_RADIUS $BORDER_RADIUS,0 fill white circle $BORDER_RADIUS,$BORDER_RADIUS $BORDER_RADIUS,0" \
|
||||||
|
\( +clone -flip \) -compose Multiply -composite \
|
||||||
|
\( +clone -flop \) -compose Multiply -composite \
|
||||||
|
\) -alpha off -compose CopyOpacity -composite "$COVER"
|
||||||
|
}
|
||||||
|
|
||||||
|
#fallback_find_cover() {
|
||||||
|
# album=$(dirname "$file")
|
||||||
|
# album_cover="$(find "$album" -type d -exec find {} -maxdepth 1 -type f -iregex ".*\(covers?\|folders?\|artworks?\|fronts?\|scans?\).*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
|
||||||
|
# [ -z "$album_cover" ] && album_cover="$(find "$album" -type d -exec find {} -maxdepth 1 -type f -iregex ".*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
|
||||||
|
# [ -z "$album_cover" ] && album_cover="$(find "${album%/*}" -type d -exec find {} -maxdepth 1 -type f -iregex ".*\(covers?\|folders?\|artworks?\|fronts?\|scans?\|booklets?\).*[.]\(jpe?g\|png\|gif\|bmp\)" \;)"
|
||||||
|
# album_cover="$(echo "$album_cover" | grep -iv '\(back\|cd\)\.' | head -n1)"
|
||||||
|
#}
|
||||||
|
|
||||||
|
mpris_album_art() {
|
||||||
|
playerctl metadata mpris:artUrl | sed 's#file://##'
|
||||||
|
# mpris_player_control -t | grep 'artUrl' | cut -f 3 -d '|' | sed 's#file://##'
|
||||||
|
}
|
||||||
|
|
||||||
|
notification() {
|
||||||
|
convert "$COVER" -resize 144x144 "$COVER_NOTIFICATION"
|
||||||
|
# notify-send -i "$COVER_NOTIFICATION" "$(playerctl metadata --format '{{title}} {{album}}')"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
file="$MUSIC_DIR/$(mpc --format %file% current)"
|
||||||
|
|
||||||
|
# [ -n "$file" ] && ffmpeg_cover "$file" && rounded_cover ||
|
||||||
|
# fallback_find_cover && ffmpeg_cover "$album_cover" && rounded_cover
|
||||||
|
# [ ! -x "$(which playerctl)" ] && echo "Install playerctl and mpDris2 for this script to work."
|
||||||
|
|
||||||
|
ffmpeg_cover "$file" && rounded_cover
|
||||||
|
notification
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
Loading…
Reference in New Issue
Block a user