[download]

local/bin/music-notify

   1 #!/bin/bash
   2 
   3 IFS=  read file icon tl artist album title < <(
   4 MUSIC_FORMAT='$file $icon $tl $artist $album $title' music)
   5 
   6 [[ $file       ]] || exit
   7 [[ $file != /* ]] && file=~/Music/$file
   8 
   9 title="$icon $title (-$tl)"
  10 pics=("${file%/*}/"*.jpg)
  11 cover=~/.cache/music-notify.png
  12 
  13 [[ $artist ]] || artist=$title title=
  14 [[ $album  ]] && artist+=" ($album)"
  15 
  16 rm $cover
  17 ffmpeg -i "$file" $cover 2>&- || cp "$pics" $cover
  18 convert $cover -thumbnail '100x>^' $cover ||
  19 printf '<svg width="22" height="22"><text font-family="Nerdfont"
  20 y="18" font-size="20" fill="#fff"></text></svg>' > $cover
  21 
  22 notify-send -a music-notify -i $cover -- "$artist" "$title"