Le premier affiche la playlist et permet de changer rapidement de chanson courante:
Code : Tout sélectionner
#!/bin/bash
# Script by ©pmd :p
TEMPFILE1=/tmp/play1aff$RANDOM.txt
TEMPFILE2=/tmp/play2aff$RANDOM.txt
function sortir {
rm -f $TEMPFILE1 $TEMPFILE2
exit $1
}
mpc -f '#|#|#|\n"%artist%"\n"%title%"\n"%album%"' playlist | tr '?()\\.' '-----' > $TEMPFILE1
num=1
while read i ; do
if [[ "$i" == "|||" ]] ; then
echo "$num" >> $TEMPFILE2
num=$(($num+1))
else
echo "$i" >> $TEMPFILE2
fi
done < $TEMPFILE1
if [[ -s "$TEMPFILE2" ]] ; then
NUMPLAY=$(cat $TEMPFILE2 | xargs zenity --list --width="600" --height="400" --column="N°" --column="Artiste" --column="Titre:" --column="Album" --text="Selectionne ou quitte" --title="Mpd control" )
if [[ -n $NUMPLAY ]] ; then
mpc -q play $NUMPLAY
fi
else
zenity --error --title="Erreur coco" --text="Pas de playliste!"
sortir 2
fi
sortir 0
Code : Tout sélectionner
#!/bin/bash
PLAYING_TEST=$(mpc | head -2 | tail -1 | sed -e 's/^\[\([a-zA-Z]*\).*/\1/ ')
if [[ $PLAYING_TEST == "playing" ]] ; then
notify-send -u low -t 1500 -i ~/Documents/music2.png -- "MPD STATUS:" "$(mpc -f '<b>%artist%</b>
<i>%album%</i>
%title%' | head -3)"
else
notify-send -u low -t 1500 -i ~/Documents/music2.png -- "MPD STATUS:" "Nothing is being played."
fi
Code : Tout sélectionner
#!/bin/bash
if [[ "" == "" ]] ; then
SPACES=" "
RETRAIT=" "
CURRENT=$(mpc current | tr '?()./\\' '------')
popo=$(mpc playlist | tr '?()./\\' '------' | cat - -n | sed 's/^[ ]*/'"$SPACES"'\t/' | column -s ' ' -t)
MESSAGE=$(echo "$popo" | sed -e 's/^'"$RETRAIT"'\([ ]*[0-9]*[ ]*\)'"$CURRENT"'$/\1<b>'"$RETRAIT$CURRENT"'<\/b>/')
MESSAGE=$(echo "$MESSAGE" | sed 's/\(^[ ]*\)\([0-9]*\)/\1<i>\2<\/i>/')
notify-send -u low -t 4000 -i ~/Documents/music2.png -- "MPD PLAYLIST:" "$MESSAGE"
fi
Servez-vous, chez moi ça marche sans bug depuis quelques semaines déjà...