Advertisement
ijontichy

mpd_status

Jun 16th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!/bin/sh -
  2.  
  3. format="%artist% - %track%:%title% - %album%"
  4.  
  5. mpcStLine=$(mpc --format "$format" | head -1)
  6. mpcTiLine=$(mpc --format "$format" | tail -2 | head -1)
  7. mpcTime=$(echo $mpcTiLine | grep -o "[0-9]*:[0-9]*" | head -1)
  8. mpcTot=$(echo $mpcTiLine | grep -o "[0-9]*:[0-9]*" | head -2 | tail -1)
  9. mpcMode=$(echo $mpcTiLine | grep -o "\[[a-z]*\]")
  10.  
  11. mpcStatus="$mpcMode $mpcStLine [$mpcTime/$mpcTot]"
  12.  
  13. echo $mpcStLine | grep "^volume" >/dev/null
  14.  
  15. if [ "$?" -eq "1" ]
  16. then
  17. echo $mpcStatus
  18. else
  19. echo "Not playing"
  20. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement