66 lines
2.2 KiB
Bash
Executable file
66 lines
2.2 KiB
Bash
Executable file
#!/bin/bash
|
|
if [ -z $1 ]
|
|
then
|
|
echo "Help
|
|
You need parameter :
|
|
* title
|
|
* artist
|
|
* album
|
|
* year
|
|
* track
|
|
* cover => copy cover to /tmp/clemCover.jpg
|
|
* bitrate
|
|
* position (%)"
|
|
exit
|
|
fi
|
|
|
|
clementineProcess=$(qdbus | grep clementine | wc -l)
|
|
|
|
if [ $clementineProcess == 0 ]
|
|
then
|
|
exit 0
|
|
fi
|
|
|
|
if [ $1 == 'title' ]
|
|
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-)
|
|
fi
|
|
|
|
if [ $1 == 'artist' ]
|
|
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-)
|
|
fi
|
|
|
|
if [ $1 == 'album' ]
|
|
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-)
|
|
fi
|
|
|
|
if [ $1 == 'year' ]
|
|
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-)
|
|
fi
|
|
|
|
if [ $1 == 'track' ]
|
|
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-)
|
|
fi
|
|
|
|
if [ $1 == 'cover' ]
|
|
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="${cover:7:${#cover}-1}"
|
|
cp $cover /tmp/clemCover.jpg
|
|
fi
|
|
|
|
if [ $1 == 'bitrate' ]
|
|
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-)
|
|
fi
|
|
|
|
if [ $1 == 'position' ]
|
|
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-)
|
|
position=$(qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)
|
|
echo $(($position*100/$lenght))
|
|
fi
|