*nohtml*

local/bin/music-notify

   1 #!/bin/bash
   2 
   3 file=$1 artist=$2 title=$3
   4 app=${0##*/} cover=~/.cache/$app.png
   5 
   6 file=${file#file://}
   7 file=$(echo -e "${file//%/\\x}")
   8 
   9 [[ ! $title || ! $artist ]] &&
  10 title= artist=${file##*/}
  11 
  12 rm $cover
  13 ffmpeg -i "$file" $cover &&
  14 convert $cover -thumbnail '100x>^' $cover ||
  15 cover=audio-x-generic
  16 
  17 gdbus call --session \
  18 --dest org.freedesktop.Notifications \
  19 --object-path /org/freedesktop/Notifications \
  20 --method org.freedesktop.Notifications.Notify \
  21 $app 1001 $cover "$artist" "$title" [] {} 2000