Advertisement
Algabe

notify-mpd

Feb 7th, 2014
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.10 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. usage="usage: $0 -c {play|stop|next|prev|info}"
  4. command=
  5.  
  6. shift $(($OPTIND - 1))
  7. command=$1
  8.  
  9. STATUS=""
  10. if [ "$command" = "" ]; then
  11.     echo "usage: $0 {play|stop|next|prev|info}"
  12.     exit 0;
  13. fi
  14.  
  15. if [ "$command" = "play" ]; then
  16.     mpc toggle
  17.     ARTIST=$(mpc -f "%artist%" current)
  18.     ALBUM=$(mpc -f "%album%" current)
  19.     TITLE=$(mpc -f "%title%" current)
  20. fi
  21.  
  22. if [ "$command" = "next" ]; then
  23.     mpc next
  24.     ARTIST=$(mpc -f "%artist%" current)
  25.     ALBUM=$(mpc -f "%album%" current)
  26.     TITLE=$(mpc -f "%title%" current)
  27. fi
  28.  
  29. if [ "$command" = "prev" ]; then
  30.     mpc prev
  31.     ARTIST=$(mpc -f "%artist%" current)
  32.     ALBUM=$(mpc -f "%album%" current)
  33.     TITLE=$(mpc -f "%title%" current)
  34. fi
  35.  
  36. if [ "$command" = "info" ]; then
  37.     ARTIST=$(mpc -f "%artist%" current)
  38.     ALBUM=$(mpc -f "%album%" current)
  39.     TITLE=$(mpc -f "%title%" current)
  40. fi
  41.  
  42. if [ "$command" = "stop" ]; then
  43.     mpc stop
  44.     STATUS="stop"
  45. fi
  46.  
  47. if [ "$STATUS" != "stop" ]; then
  48.     notify-send "$TITLE" "$ARTIST" -i "/home/algabe/Music/$ARTIST/$ALBUM/$ALBUM.jpg" -h string:synchronous:mpd
  49. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement