Guest User

Untitled

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