Add test for clementine running
This commit is contained in:
parent
b607b9a60a
commit
675c1a4869
1 changed files with 32 additions and 26 deletions
58
cctine
58
cctine
|
@ -1,5 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ -z $1 ]
|
if [ -z $1 ]
|
||||||
then
|
then
|
||||||
echo "Help
|
echo "Help
|
||||||
|
@ -15,46 +14,53 @@ You need parameter :
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
clementineProcess=$(qdbus | grep clementine | wc -l)
|
||||||
|
|
||||||
|
if [ $clementineProcess == 0 ]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $1 == 'title' ]
|
if [ $1 == 'title' ]
|
||||||
then
|
then
|
||||||
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "title:"| cut -d " " -f2-)
|
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "title:"| cut -d " " -f2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 == 'artist' ]
|
if [ $1 == 'artist' ]
|
||||||
then
|
then
|
||||||
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "artist:"| cut -d " " -f2-)
|
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "artist:"| cut -d " " -f2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 == 'album' ]
|
if [ $1 == 'album' ]
|
||||||
then
|
then
|
||||||
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "album:"| cut -d " " -f2-)
|
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "album:"| cut -d " " -f2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 == 'year' ]
|
if [ $1 == 'year' ]
|
||||||
then
|
then
|
||||||
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "year:"| cut -d " " -f2-)
|
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "year:"| cut -d " " -f2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 == 'track' ]
|
if [ $1 == 'track' ]
|
||||||
then
|
then
|
||||||
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "trackNumber:"| cut -d " " -f2-)
|
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "trackNumber:"| cut -d " " -f2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 == 'cover' ]
|
if [ $1 == 'cover' ]
|
||||||
then
|
then
|
||||||
cover=$(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "artUrl:"| cut -d " " -f2-)
|
cover=$(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "artUrl:"| cut -d " " -f2-)
|
||||||
cover="${cover:7:${#cover}-1}"
|
cover="${cover:7:${#cover}-1}"
|
||||||
cp $cover /tmp/clemCover.jpg
|
cp $cover /tmp/clemCover.jpg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 == 'bitrate' ]
|
if [ $1 == 'bitrate' ]
|
||||||
then
|
then
|
||||||
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "bitrate:"| cut -d " " -f2-)
|
echo $(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "bitrate:"| cut -d " " -f2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 == 'position' ]
|
if [ $1 == 'position' ]
|
||||||
then
|
then
|
||||||
lenght=$(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "length:"| cut -d " " -f2-)
|
lenght=$(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -e "length:"| cut -d " " -f2-)
|
||||||
position=$(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)
|
position=$(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)
|
||||||
echo $(($position*100/$lenght))
|
echo $(($position*100/$lenght))
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue