Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 #!/bin/bash
- 2 $(cmus-remote -q ~/song52.mp3)
- 3 $(cmus-remote -p)
- 4 while [ 1 = 1 ]
- 5 do
- 6 #uncomment to refresh in line
- 7 #echo -ne "\r\033[K"
- 8 RUNNING=$(cmus-remote -C status)
- 9 OUTPUT=""
- 10 if [ "$RUNNING" == '' ]
- 11 then
- 12 printf " "
- 13 else
- 14 TOTAL=$(cmus-remote -Q | grep 'duration ' | sed -r 's/^.{8}//')
- 15 if [ "$TOTAL" == '' ]
- 16 then
- 17 printf "No song selected"
- 18 else
- 19 TOTAL=$(cmus-remote -Q | grep 'duration ' | sed -r 's/^.{8}//')
- 20 SECONDS=$(cmus-remote -Q | grep 'position ' | sed -r 's/^.{8}//')
- 21 STATUS=$(cmus-remote -Q | grep status | sed -r 's/^.{7}//')
- 22 TITLE=$(cmus-remote -Q | grep title | sed -r 's/^.{10}//')
- 23 ARTIST=$(cmus-remote -Q | grep ' artist ' | sed -r 's/^.{11}//')
- 24 ALBUM=$(cmus-remote -Q | grep ' album ' | sed -r 's/^.{10}//')
- 25 FILE=$(cmus-remote -Q | grep 'file ' | sed -r 's/^.{5}//')
- 26 if [ "$STATUS" == "playing" ]
- 27 then
- 28 OUTPUT=$OUTPUT" "
- 29 elif [ "$STATUS" == "paused" ]
- 30 then
- 31 OUTPUT=$OUTPUT" "
- 32 elif [ "$STATUS" == "stopped" ]
- 33 then
- 34 OUTPUT=$OUTPUT" "
- 35 else
- 36 OUTPUT=$OUTPUT"$STATUS"
- 37 fi
- 38 if [ "$TITLE" == "" ] && [ "$ARTIST" == "" ] && [ "$ALBUM" == "" ]
- 39 then
- 40 OUTPUT=$OUTPUT"$FILE"
- 41 elif [ "$TITLE" == "" ]
- 42 then
- 43 OUTPUT=$OUTPUT"$FILE"" - ""$ARTIST"" - ""$ALBUM"
- 44 else
- 45 OUTPUT=$OUTPUT"$TITLE"" - ""$ARTIST"" - ""$ALBUM"
- 46 fi
- 47 OUTPUT=$OUTPUT" | "
- 48 printf "%s%02d:%02d/%02d:%02d " "$OUTPUT" $(($SECONDS/60)) $(($SECONDS%60)) $(($TOTAL/60)) $(($TOTAL%60))
- 49 fi
- 50 fi
- 51 sleep 1
- 52 done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement