mirror of https://github.com/E-Almqvist/dotfiles
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
698 B
21 lines
698 B
4 years ago
|
#!/bin/bash
|
||
|
|
||
|
prepend_zero () {
|
||
|
seq -f "%02g" $1 $1
|
||
|
}
|
||
|
|
||
|
artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-))
|
||
|
|
||
4 years ago
|
if [[ $artist = *[!\ ]* ]]; then
|
||
4 years ago
|
song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-))
|
||
|
position=$(cmus-remote -C status | grep position | cut -c 10-)
|
||
|
minutes1=$(prepend_zero $(($position / 60)))
|
||
|
seconds1=$(prepend_zero $(($position % 60)))
|
||
|
duration=$(cmus-remote -C status | grep duration | cut -c 10-)
|
||
|
minutes2=$(prepend_zero $(($duration / 60)))
|
||
|
seconds2=$(prepend_zero $(($duration % 60)))
|
||
|
echo -n "$artist - $song [$minutes1:$seconds1/$minutes2:$seconds2]"
|
||
4 years ago
|
else
|
||
|
echo
|
||
|
fi
|