Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 #!/bin/bash
- 2
- 3 prepend_zero () {
- 4 seq -f "%02g" $1 $1
- 5 }
- 6
- 7 artist=$(echo -n $(cmus-remote -C status | grep artist -m 1| cut -c 12-))
- 8 song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-))
- 9
- 10 position=$(cmus-remote -C status | grep position | cut -c 10-)
- 11 minutes1=$(prepend_zero $(($position / 60)))
- 12 seconds1=$(prepend_zero $(($position % 60)))
- 13
- 14 duration=$(cmus-remote -C status | grep duration | cut -c 10-)
- 15 minutes2=$(prepend_zero $(($duration / 60)))
- 16 seconds2=$(prepend_zero $(($duration % 60)))
- 17
- 18 echo -n "$artist - $song [$minutes1:$seconds1 / $minutes2:$seconds2]"
Advertisement
Add Comment
Please, Sign In to add comment