[download]
local/bin/music-notify
1
2
3 source music || exit 1
4 [[ $file != /* ]] && file=~/Music/$file
5
6 cover=/tmp/$$.png
7 pics=("${file%/*}/"*.jpg)
8 title="$icon $title (-$tl)"
9
10 [[ $artist ]] || artist=$title title=
11 [[ $album ]] && artist+=" ($album)"
12
13 [[ $file =~ https://www.youtube.com/watch\?v=(.+)$ ]] && pics=$cover &&
14 wget -qO $cover https://i1.ytimg.com/vi/${BASH_REMATCH[1]}/hqdefault.jpg
15
16 ffmpeg -i "$file" $cover 2>&- || cp "$pics" $cover
17 convert $cover -thumbnail '100x>^' $cover ||
18 printf '<svg width="22" height="22"><text font-family="Nerdfont"
19 y="18" font-size="20" fill="#fff"></text></svg>' > $cover
20
21 notify-send -a music-notify -i $cover -- "$artist" "$title"
22 rm -f $cover
|