Petite précision : il s'agit ici d'un thème superkaramba.
Pour ce qui concerne l'audio, il faut utiliser amarok.
Quand on démarre amarok la première fois, il faut indiquer où se trouvent les MP3 et une bibliothèque est ainsi créée. Amarok récupère - quand c'est possible - les pochettes des différents MP3. Ces prochettes sont stockées dans un dossier sous forme codée.
Dans mon thème, il y a les fonctions qui permettent d'aller chercher différentes indications concernant le MP3 en cours : interprète, album, durée, code de la pochette, etc..
Pour gérer le son, voici les commandes :
Code : Tout sélectionner
clickarea x=0 y=0 w=20 h=20 onclick="qdbus org.kde.amarok /Player Prev" # précédent
clickarea x=25 y=0 w=20 h=20 onclick="/usr/bin/amarok" # démarrer amarok
clickarea x=47 y=0 w=20 h=20 onclick="killall amarok" # arrêter amarok
clickarea x=76 y=0 w=20 h=20 onclick="qdbus org.kde.amarok /Player Pause" # pause/reprendre
clickarea x=105 y=0 w=20 h=20 onclick="qdbus org.kde.amarok /Player Next" # suivant
clickarea x=137 y=0 w=20 h=20 onclick="qdbus org.kde.amarok /Player VolumeSet $((`qdbus org.kde.amarok /Player VolumeGet` -3))" # baisser le son
clickarea x=165 y=0 w=20 h=20 onclick="qdbus org.kde.amarok /Player VolumeSet $((`qdbus org.kde.amarok /Player VolumeGet` +3))" # augmenter le son
Pour récupérer la pochette :
Dans le thème, je fais appel à un script nommé cover.sh
Code : Tout sélectionner
image x=27 y=165 sensor=program program="sh /home/okapi/karamba_themes/minithema/scripts/cover.sh"
Et le script lui-même :
Code : Tout sélectionner
#!/bin/sh
if [ `qdbus org.kde.amarok /Player GetMetadata | grep arturl | cut -d : -f 2` ];
then
convert "`qdbus org.kde.amarok /Player GetMetadata |grep arturl | cut -d : -f 3 | cut -c 3- | sed "s/%20/ /g"`" -resize 50x50! /tmp/img.png
echo /tmp/img.png
else
echo images/pingouin.png
fi
L'image pingouin.png s'affiche lorsque le MP3 ne dispose pas de pochette ou quand amarok n'est pas en cours.
En fait, la commande de base est
qdbus org.kde.amarok /Player GetMetadata
Si tu lances une chanson avec amarok puis qu'en console, tu exécutes cette commande, ça donne :
Code : Tout sélectionner
[okapi@Archie ~]$ qdbus org.kde.amarok /Player GetMetadata
album: Led Zeppelin
albumartist: Led Zeppelin
artist: Led Zeppelin
arturl: file:///home/okapi/.kde4/share/apps/amarok/albumcovers/cache/135@7af940af45df0dfa510d3c99fba39968
audio-bitrate: 128
audio-samplerate: 44100
comment:
genre: Classic Rock
location: file:///media/win_2/MP3/MP3%20Led%20Zeppelin/Led%20Zeppelin-Led%20Zeppelin-08-I%20Can't%20Quit%20You%20Baby.mp3
lyrics:
I-I, I can't quit you, babe
So I'm gonna put you down for a while
I said, I can't quit you, babe
I guess I got to put you down for a while
Said, you messed-up my happy home
Made me mistreat my only child
Yes, you did, babe, oh
Said, you know I love you, baby
My love for you I could never hide
Oh, you know I love you, babe
My love for you I could never hide
A-when I feel you near me, little girl
I know you are my one desire, whoa-oh, oh-oh, yeah
Oh, that's wonderful, whoa
Whoa
That's wonderful yeah!
When ya hear me moanin' and groanin', baby
You know it hurts me deep down inside
Oh, when ya hear me moanin' and groanin', babe
You know it hurts me deep down inside
Oh, a-when you hear me hollar, baby
You know you're my one desire, yes, you are, oh alright
mtime: 283000
rating: 0
time: 283
title: I Can't Quit You Baby
tracknumber: 8
year: 1969
Le code de la pochette (arturl) : 135@7af940af45df0dfa510d3c99fba39968 renvoie à l'image qui se trouve dans ~/.kde4/share/apps/amarok/albumcovers/cache :
Voilà.
Si tu veux d'autres infos, dis le moi.