[download]

local/bin/player-notify

   1 #!/bin/bash
   2 
   3 source player  || exit 1
   4 [[ $file != /* ]] && file=~/Музыка/$file
   5 
   6 cover=/tmp/$$.png
   7 pics=("${file%/*}/"*.jpg)
   8 head="$artist"
   9 body="$icon $title (-$tl)"
  10 
  11 [[ $artist ]] || head=$body body=
  12 [[ $album  ]] && body+="\n\n[ $album ]"
  13 
  14 [[ $file =~ https://www.youtube.com/watch\?v=(.+)$ ]] && pics=$cover &&
  15 wget -qO $cover https://i1.ytimg.com/vi/${BASH_REMATCH[1]}/hqdefault.jpg
  16 
  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 player-$player -i $cover -- "$head" "$body"
  23 rm -f $cover