Affiche l'artiste, le titre et l'album avec notify-send.
TODO : n'envoyer qu'un seul notify-send pour chaque morceau (là, on en envoie un à chaque fois qu'on reçoit une info.
This commit is contained in:
parent
353058148c
commit
69b1861d9b
|
@ -1,15 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# notify-send -i ~/img/fonds\ d\'écran/3153_small.jpg "JCRZ - Deep blue (2005)" "blablabla"
|
||||||
|
|
||||||
source "$(dirname "$0")/config"
|
source "$(dirname "$0")/config"
|
||||||
|
|
||||||
q="'"
|
q="'"
|
||||||
|
|
||||||
old_titre=""
|
old_titre=""
|
||||||
|
old_artiste=""
|
||||||
|
old_album=""
|
||||||
|
|
||||||
cat "$MP_OUTPUT" \
|
cat "$MP_OUTPUT" \
|
||||||
| while read ligne; do
|
| while read ligne; do
|
||||||
# TODO : utiliser grep n'est pas du tout efficace !
|
# TODO : utiliser grep n'est pas du tout efficace !
|
||||||
if grep -q "^[a-zA-Z_][a-zA-Z0-9_]*='"<<<"$ligne"; then
|
if grep -q "^[a-zA-Z_][a-zA-Z0-9_]*='"<<<"$ligne"; then
|
||||||
|
modif=0
|
||||||
cle="${ligne%%=$q*}"
|
cle="${ligne%%=$q*}"
|
||||||
valeur="${ligne#*=$q}"
|
valeur="${ligne#*=$q}"
|
||||||
valeur="${valeur%$q}"
|
valeur="${valeur%$q}"
|
||||||
|
@ -18,11 +23,36 @@ cat "$MP_OUTPUT" \
|
||||||
old_titre="$titre"
|
old_titre="$titre"
|
||||||
titre="$valeur"
|
titre="$valeur"
|
||||||
if [ "$titre" != "$old_titre" ]; then
|
if [ "$titre" != "$old_titre" ]; then
|
||||||
|
modif=1
|
||||||
echo "TITRE = $titre"
|
echo "TITRE = $titre"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
ANS_META_ARTIST)
|
||||||
|
old_artiste="$artiste"
|
||||||
|
artiste="$valeur"
|
||||||
|
if [ "$artiste" != "$old_artiste" ]; then
|
||||||
|
modif=1
|
||||||
|
echo "ARTISTE = $artiste"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
ANS_META_ALBUM)
|
||||||
|
old_album="$album"
|
||||||
|
album="$valeur"
|
||||||
|
if [ "$album" != "$old_album" ]; then
|
||||||
|
modif=1
|
||||||
|
echo "ALBUM = $album"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
if [ "$modif" != "0" ]; then
|
||||||
|
notify-send -i ~/img/fonds\ d\'écran/3153_small.jpg "$artiste - $titre" "Album: $album"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
(echo "get_meta_title" > "$MP_CONTROL") &
|
# TODO : peut-être envoyer seulement quand il affiche "now playing..."
|
||||||
|
(
|
||||||
|
echo "get_meta_title" > "$MP_CONTROL"
|
||||||
|
echo "get_meta_artist" > "$MP_CONTROL"
|
||||||
|
echo "get_meta_album" > "$MP_CONTROL"
|
||||||
|
) &
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user