first commit

This commit is contained in:
Knah Tsaeb 2016-09-05 12:38:01 +02:00
commit b607b9a60a
3 changed files with 135 additions and 0 deletions

71
README.md Normal file
View file

@ -0,0 +1,71 @@
# cctine
cctine is simple command line tool for get Clementine now playing information. Like
[conkyclementine](https://launchpad.net/~conky-companions/+archive/ubuntu/ppa) but work with [mpris2](https://specifications.freedesktop.org/mpris-spec/latest/).
You can find git repo at https://forge.leslibres.org/Knah-Tsaeb/cctine
## License
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Knah Tsaeb
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
## Install
`sudo sh ./install.sh`
## Usage
* `cctine title` => return title
* `cctine artist` => return artist
* `cctine album` => return album
* `cctine year` => return year
* `cctine track` => return track number
* `cctine cover` => return nothing just copy cover to /tmp/clemCover.jpg
* `cctine bitrate` => return bitrate
* `cctine position` => return percent of progress
## Conky example
```
${if_running clementine}${color5}${font Century Schoolbook L:size=11}Clementine ${hr}${font}
${execi 12 cctine cover > /dev/null}
${image /tmp/clemCover.jpg -p 12,178 -s 280x280 -f 6 }
${offset 15}${color}Artist : ${color}${execi 5 cctine artist}
${offset 15}${color}Album : ${color}${execi 5 cctine album} (${execi 5 cctine year})
${offset 15}${color}Piste : ${color}${execi 5 cctine track} - ${execi 5 cctine title}
${offset 15}${color}Encodage : ${color}${execi 5 cctine bitrate}kbps
${offset 15}${color}${color}${execibar 4 cctine position}
$endif
```

60
cctine Executable file
View file

@ -0,0 +1,60 @@
#!/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
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

4
install.sh Normal file
View file

@ -0,0 +1,4 @@
#!bin/bash
cp cctine /usr/bin/
chmod +x /usr/bin/cctine
echo "Installation finish"