Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [[ `pgrep clementine` ]] ; then
- data=$(qdbus org.mpris.clementine /Player org.freedesktop.MediaPlayer.GetMetadata )
- artist=$( echo "$data" | grep ^artist: | sed -e 's/artist://' | sed -e 's/^ //' )
- title=$( echo "$data" | grep ^title: | sed -e 's/title://' | sed -e 's/^ //' )
- art=$(echo "$data" | grep ^arturl: | sed -e 's/arturl://' | sed -e 's/^ //' | sed -e 's|file://||' )
- mtime=$(echo "$data" | grep ^mtime: | sed -e 's/mtime://' | sed -e 's/^ //' )
- mtime=$(( mtime/1000 ))
- etime=$( qdbus org.mpris.clementine /Player org.freedesktop.MediaPlayer.PositionGet )
- etime=$(( etime/1000 ))
- fi
- case "$1" in
- "a" )
- echo $artist
- ;;
- "t" )
- echo $title
- ;;
- "e" )
- if (( $(( etime%60)) > 9 ))
- then echo "$(( etime/60 )):$(( etime%60))"
- else echo "$(( etime/60 )):0$(( etime%60))"
- fi
- ;;
- "m" )
- if (( $(( mtime%60)) > 9 ))
- then echo "$(( mtime/60 )):$(( mtime%60))"
- else echo "$(( mtime/60 )):0$(( mtime%60))"
- fi
- ;;
- "c" )
- echo $art
- ;;
- "b" )
- echo $(( etime*100/mtime ))
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement