Advertisement
lauriset

notify

May 28th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. MUSIC_DIR=$HOME/Música/ # Your music directory
  4. COVER=/tmp/cover.jpg
  5.  
  6. {
  7. album="$(mpc --format %album% current -p 6600)"
  8. file="$(mpc --format %file% current -p 6600)"
  9. album_dir="${file%/*}"
  10. [[ -z "$album_dir" ]] && exit 1
  11. album_dir="$MUSIC_DIR/$album_dir"
  12. covers="$(find "$album_dir" -type d -exec find {} -maxdepth 1 -type f -iregex ".*/.*\(${album}\|cover\|folder\|artwork\|front\).*[.]\(jpe?g\|png\|gif\|bmp\)" \; )"
  13. src="$(echo -n "$covers" | head -n1)"
  14. rm -f "$COVER"
  15.  
  16. # For Notifications
  17. if [[ -n "$src" ]] ; then
  18. # Resize the image's width to 64px
  19. convert "$src" -resize 64x "$COVER"
  20. if [[ -f "$COVER" ]] ; then
  21. notify-send -u low -i ${COVER} " Now Playing" "`mpc current`"
  22. fi
  23. fi
  24. } &
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement