SEBCO A CONCOCTER UNE PAGE SUR LE WIKI TRÈS BIEN DOCUMENTÉE ET POSSÉDANT LES LIENS DE TÉLÉCHARGEMENT VERS LES THÈMES D'IMAGES ET LE LOGICIEL DE KANOR MAINTENU A JOUR QUI FACILITE L'INSTALLATION PLUTÔT QUE MES SCRIPTS

Lien vers le wiki: http://doc.ubuntu-fr.org/personnalisation_/cubemodel_de_compiz_et_wallpaper_dynamique#installation_d_un_wallmeteo

Je laisse le tuto originel ci dessous pour l'historique du projet. Le topic vous servira pour faire remonter les bugs, donner de nouvelles idées, ou vos pârticipations graphiques. Amusez vous bien!




LIEN AVEC LE TOPIC http://forum.ubuntu-fr.org/viewtopic.php?id=255827

A l'aide d'un fichier xml, on peut créer un fond d'écran dynamique selon l'heure de la journée. A L'aide des Scripts qui suivent on peut avoir un fond d'écran dynamique selon l'heure de la journée et de la météo. Il y a maintenant 3 méthodes pour obtenir ce fond d'écran dynamique. La mienne la plus compliquée et la moins propre (la première quoi), celle de Orion Elenion, dérivée de la mienne, mais qui simplifie le code, et celle de Kanor, utilisant python mais utilisant la même technique, à peu de choses près. Donc les packs d'images seront compatibles avec les trois methodes.

METHODE D'EMRIS

Etape 1:

Installez le paquet xsltproc (c'est leger).
Installez le paquet w3m

Créez un dossier background dans votre home.

Etape 2

Dans ce dossier copiez les fichiers suivants:
meteo.xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
        <xsl:output method="text" disable-output-escaping="yes"/>
        <xsl:template match="weather">
        	<xsl:text>Ville : </xsl:text><xsl:value-of select="/weather/loc/dnam"/>
                <xsl:apply-templates select="cc"/>
                <xsl:apply-templates select="dayf/day[@d='1']"/>
                <xsl:text>
Lever du soleil : </xsl:text><xsl:value-of select="/weather/loc/sunr"/>
		<xsl:text>
Coucher du soleil : </xsl:text><xsl:value-of select="/weather/loc/suns"/>
        </xsl:template>

        <xsl:template match="cc">
<xsl:text>
Température aujourd'hui : </xsl:text><xsl:value-of select="tmp"/> <xsl:value-of select="/weather/head/ut"/>
<xsl:if test="tmp != flik">
<xsl:text> (</xsl:text>
<xsl:value-of select="flik"/> <xsl:value-of select="/weather/head/ut"/>
<xsl:text> ressenti)</xsl:text>
</xsl:if>
<xsl:text>
Conditions aujourd'hui : </xsl:text><xsl:value-of select="t"/>
<xsl:text>
Vent aujourd'hui : </xsl:text>
<xsl:choose>
<xsl:when test="wind/s = 'calm'"><xsl:text>0</xsl:text></xsl:when>
<xsl:otherwise><xsl:value-of select="wind/s"/></xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:value-of select="/weather/head/us"/>
</xsl:template>

<xsl:template match="dayf/day[@d='1']">
<xsl:text>
Température demain : de </xsl:text><xsl:value-of select="low"/> <xsl:value-of select="/weather/head/ut"/>
<xsl:text> a </xsl:text><xsl:value-of select="hi"/> <xsl:value-of select="/weather/head/ut"/>
<xsl:text>
Conditions demain : </xsl:text><xsl:value-of select="part[@p='d']/t"/>
</xsl:template>
</xsl:stylesheet>
cloudy.xml
<background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/cloudy1.jpeg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/cloudy1.jpeg</from>
<to>/home/emris/background/cloudy2.jpeg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/cloudy2.jpeg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/cloudy2.jpeg</from>
<to>/home/emris/background/cloudy3.jpeg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/cloudy3.jpeg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/cloudy3.jpeg</from>
<to>/home/emris/background/cloudy4.jpeg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/cloudy4.jpeg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/cloudy4.jpeg</from>
<to>/home/emris/background/cloudy1.jpeg</to>
</transition>
</background>
fair.xml
background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/fair1.jpeg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/fair1.jpeg</from>
<to>/home/emris/background/fair2.jpeg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/fair2.jpeg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/fair2.jpeg</from>
<to>/home/emris/background/fair3.jpeg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/fair3.jpeg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/fair3.jpeg</from>
<to>/home/emris/background/fair4.jpeg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/fair4.jpeg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/fair4.jpeg</from>
<to>/home/emris/background/fair1.jpeg</to>
</transition>
</background>
partly_cloudy.xml
<background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/partly_cloudy1.jpeg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/partly_cloudy1.jpeg</from>
<to>/home/emris/background/partly_cloudy2.jpeg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/partly_cloudy2.jpeg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/partly_cloudy2.jpeg</from>
<to>/home/emris/background/partly_cloudy3.jpeg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/partly_cloudy3.jpeg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/partly_cloudy3.jpeg</from>
<to>/home/emris/background/partly_cloudy4.jpeg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/partly_cloudy4.jpeg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/partly_cloudy4.jpeg</from>
<to>/home/emris/background/partly_cloudy1.jpeg</to>
</transition>
</background>
rain.xml
<background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/rain1.jpeg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/rain1.jpeg</from>
<to>/home/emris/background/rain2.jpeg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/rain2.jpeg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/rain2.jpeg</from>
<to>/home/emris/background/rain3.jpeg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/rain3.jpeg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/rain3.jpeg</from>
<to>/home/emris/background/rain4.jpeg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/rain4.jpeg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/rain4.jpeg</from>
<to>/home/emris/background/rain1.jpeg</to>
</transition>
</background>
shower.xml
<background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/shower1.jpeg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/shower1.jpeg</from>
<to>/home/emris/background/shower2.jpeg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/shower2.jpeg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/shower2.jpeg</from>
<to>/home/emris/background/shower3.jpeg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/shower3.jpeg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/shower3.jpeg</from>
<to>/home/emris/background/shower4.jpeg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/shower4.jpeg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/shower4.jpeg</from>
<to>/home/emris/background/shower1.jpeg</to>
</transition>
</background>
snow.xml
<background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/snow1.jpeg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/snow1.jpeg</from>
<to>/home/emris/background/snow2.jpeg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/snow2.jpeg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/snow2.jpeg</from>
<to>/home/emris/background/snow3.jpeg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/snow3.jpeg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/snow3.jpeg</from>
<to>/home/emris/background/snow4.jpeg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/snow4.jpeg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/snow4.jpeg</from>
<to>/home/emris/background/snow1.jpeg</to>
</transition>
</background>
storm.xml
<background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/storm1.jpeg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/storm1.jpeg</from>
<to>/home/emris/background/storm2.jpeg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/storm2.jpeg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/storm2.jpeg</from>
<to>/home/emris/background/storm3.jpeg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/storm3.jpeg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/storm3.jpeg</from>
<to>/home/emris/background/storm4.jpeg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/storm4.jpeg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/storm4.jpeg</from>
<to>/home/emris/background/storm1.jpeg</to>
</transition>
</background>
sunny.xml
<background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/sunny1.jpeg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/sunny1.jpeg</from>
<to>/home/emris/background/sunny2.jpeg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/sunny2.jpeg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/sunny2.jpeg</from>
<to>/home/emris/background/sunny3.jpeg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/sunny3.jpeg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/sunny3.jpeg</from>
<to>/home/emris/background/sunny4.jpeg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/sunny4.jpeg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/sunny4.jpeg</from>
<to>/home/emris/background/sunny1.jpeg</to>
</transition>
</background>
Les fichiers xml contiennent les chemeins d'images pour ma machine. Pour les adapter à votre système (et si vopus avez bien placer le dossier background dans votre /home) utilisez simplement la commande suivante dans un terminal:
cd /home/votrenom/background
sed -i 's/emris/votrenom/g' *.xml
fog.xml
<background>
  <starttime>
    <year>2007</year>
    <month>09</month>
    <day>26</day>
    <hour>07</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 7 AM. -->

<!-- We start with sunrise at 7 AM. It will remain up for 1 hour. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/fog1.jpg</file>
</static>

<!-- Sunrise starts to transition to day at 8 AM. The transition lasts for 5 hours, ending at 1 PM. -->
<transition type="overlay">
<duration>18000.0</duration>
<from>/home/emris/background/fog1.jpg</from>
<to>/home/emris/background/fog2.jpg</to>
</transition>

<!-- It's 1 PM, we're showing the day image in full force now, for 2 hours ending at 3 PM. -->
<static>
<duration>7200.0</duration>
<file>/home/emris/background/fog2.jpg</file>
</static>

<!-- It's 3 PM, and we're starting to transition to sunset. Transition completes at 6 PM. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/fog2.jpg</from>
<to>/home/emris/background/fog3.jpg</to>
</transition>

<!-- It's 6 PM, and it's sunset, for an hour. Ends at 7. -->
<static>
<duration>3600.0</duration>
<file>/home/emris/background/fog3.jpg</file>
</static>

<!-- It's 7 PM and it's going to start to get darker. This will transition for 3 hours up until 10pm. -->
<transition type="overlay">
<duration>10800.0</duration>
<from>/home/emris/background/fog3.jpg</from>
<to>/home/emris/background/fog4.jpg</to>
</transition>

<!-- It's 10pm. It'll stay dark for 7 hours up until 5 AM. -->
<static>
<duration>25200.0</duration>
<file>/home/emris/background/fog4.jpg</file>
</static>

<!-- It's 5 AM. We'll start transitioning to sunrise for 2 hours up until 7 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/home/emris/background/fog4.jpg</from>
<to>/home/emris/background/fog1.jpg</to>
</transition>
</background>
Etape 3

Toujours dans votre dossier background copiez les scripts suivant:

meteo.sh
#!/bin/bash
#Scipt à placer au demarage
RUNDIR=/home/emris/background #Remplacez /home/emris par /home/votre_login

Verification(){
$RUNDIR/meteo1.sh XXXXX #Modifier XXXXX selon le dode de votre ville
$RUNDIR/meteo2.sh "Conditions aujourd'hui"
}

Boucle(){
sleep 15m #le scipt verifiera la météo toutes les 15 minutes. Modifier la valeur à votre guise.
Verification
Boucle
}

Verification
Boucle
meteo1.sh
#!/bin/bash

# Répertoire de ce script et du XSLT
RUNDIR=/home/emris/background #Remplacez /home/emris par /home/votre_login
# Emplacement du XSLT
XSLT=$RUNDIR/meteo.xslt
# Fichier de destination des informations
DESTFILE=/tmp/meteo.txt
# Emplacement de xsltproc
XSLTCMD=/usr/bin/xsltproc

# Traitement
URL="http://xoap.weather.com/weather/local/$1?cc=*&unit=m&dayf=2"
w3m -dump $URL | $XSLTCMD $XSLT - > $DESTFILE
meteo2.sh
#!/bin/bash

# Fichier où sont stockées les informations
SRCFILE=/tmp/meteo.txt

# Traitement
RESULTAT=$(grep "$1" $SRCFILE | awk -F " : " '{print $2}')

# Transformation de la condition en fond d'écran
echo "$1" | grep -i -q 'condition'
	  if echo "$RESULTAT" | grep -i -q 'partly cloudy'; then
		cp -f partly_cloudy.xml background.xml
	elif echo "$RESULTAT" | grep -i -q 'fair'; then
		cp -f fair.xml background.xml
	elif echo "$RESULTAT" | grep -i -q 'sunny'; then
		cp -f sunny.xml background.xml
	elif echo "$RESULTAT" | grep -i -q 'cloudy'; then
		cp -f cloudy.xml background.xml
	elif echo "$RESULTAT" | grep -E -i -q 'storm|thunder'; then
		cp -f storm.xml background.xml
	elif echo "$RESULTAT" | grep -i -q 'snow'; then
		cp -f snow.xml background.xml
	elif echo "$RESULTAT" | grep -i -q 'rain'; then
		cp -f rain.xml background.xml
	elif echo "$RESULTAT" | grep -i -q 'shower'; then
		cp -f shower.xml background.xml
	elif echo "$RESULTAT" | grep -i -q 'fog'; then
        cp -f fog.xml background.xml
       fi
meteo_demarrage.sh
#!/bin/bash
cd /home/emris/background #Remplacez /home/emris par /home/votre_login
sh meteo.sh
Dans le script meteo.sh à la cinqième ligne, remplacez la valeur xxxxxx par le code de votre ville. Pour cela, rendez vous sur le site weather.com. Cherchez votre ville dans le champ de recherche. Votre navigateur ouvrira alors une page avec la météo pour votre ville. Dans la barre d'adresse de votre navigateur vous devriez avoir, à la fin de l'URL une valeur du type FRXX0153 (valeur pour ma ville), c'est le code de votre ville.

Là aussi il faut preciser aux scipts l'endroit où vous avez placé le dossier background. Donc, dans un terminal, executez la commande suivante
cd /home/votrenom/background
sed -i 's/emris/votrenom/g' *.sh
Rendez les scipts executable.

Placez le script meteo_demarrage.sh au demarrage de gnome.

Etape 4

Et les images alors? me direz-vous? Ca je laisse le soin aux graphistes de nous faire de jolies images.
Il faudra faire un pack de 4x8 images. En effet, il y a en tout 9 conditions météo, il faut donc faire 8 images comme suit:

1 "party_cloudy" qui correspond à un temps peu nuageux avec eclaircies
2 "fair" temps plus nuageux avec moins d'éclaircies
3 "cloudy" temps totalement couvert
4 "sunny" soleil
5 "storm" tempête/orage
6 "snow" neige
7 "shower" petite pluie
8 "rain" grosse pluie
9 "fog" brouillard

Ensuite pour chaque conditions météo, il faut 4 images correspondants au moments de la journé. Par exemple, pour la condition "soleil" il faut 4 images nommée comme suit:

1 sunny1.jpeg correspondant à l'aurore
2 sunny2.jpeg correspondant au jour
3 sunny3.jpeg correspondant au crepuscule
4 sunny4.jpeg correspondant à la nuit

Faire de même pour les autres conditions météo.
Placer vos images dans le dossier background.

Etape 5

Redémarrez votre système
Faites pointer gnome, dans le choix des fonds d'ecran, vers le fichier /home/votre_login/background/background.xml

Et voilà! Votre fichier background.xml sera remis à jour tous les 1/4 d'heures, le fichier xml se chargeant du calage horaire et le script du calage climatique. :cool: 😃


EDIT DU 29 octobre 2008: Mis à jour de meteo.sh, se reporter au code plus haut. Ajout du script meteo_demarrage.sh à mettre au demmarage de gnome à la place de meteo.sh.


METHODE D'ORION ELENION

ETAPE 1
Installez le paquet xsltproc
Créez un dossier .dynbg dans votre home

ETAPE 2
Copiez dans ce dossier les 8 fichiers XML de la précédente methode
Copiez le script suivant

meteo.sh
#!/bin/sh



# Répertoire parent

PARENT_DIR=${HOME}/.dynbg



# Fichier de destination des informations

DEST_FILE=${PARENT_DIR}/meteo.xml



# Emplacement des binaires exécutables

WGET=$( /usr/bin/which wget )

XMLLINT=$( /usr/bin/which xmllint )



# Test de présence des binaires

[ -z "${WGET}" ] && ( echo '['"$( date +'%Y%m%d-%H:%M:%S' )"'] Impossible de trouver wget.' >&2 ; exit 1 )

[ -z "${XMLLINT}" ] && ( echo '['"$( date +'%Y%m%d-%H:%M:%S' )"'] Impossible de trouver xmllint.' >&2 ; exit 1 )



# Définition de l'URL à télécharger

URL='http://xoap.weather.com/weather/local/'"$1"'?cc=*&unit=m&dayf=2'



# Téléchargement de l'URL

${WGET} -q -O ${DEST_FILE} ${URL} || ( echo '['"$( date +'%Y%m%d-%H:%M:%S' )"'] Impossible de télécharger le fichier '"${URL}"'.' >&2 ; exit 1 )



# Récupération du temps actuel

WEATHER=$( echo 'xpath string( //cc/t )' | ${XMLLINT} --shell ${DEST_FILE} | awk -F' : ' '{ print $2 }' )



# Parsing du temps actuel et remplacement du fichier de fond d'écran

if echo "${WEATHER}" | grep -i -q 'partly cloudy' ; then

    cp -f ${PARENT_DIR}/partly_cloudy.xml ${PARENT_DIR}/background.xml

elif echo "${WEATHER}" | grep -i -q 'fair' ; then

    cp -f ${PARENT_DIR}/fair.xml ${PARENT_DIR}/background.xml

elif echo "${WEATHER}" | grep -i -q 'sunny' ; then

    cp -f ${PARENT_DIR}/sunny.xml ${PARENT_DIR}/background.xml

elif echo "${WEATHER}" | grep -i -q 'cloudy' ; then

    cp -f ${PARENT_DIR}/cloudy.xml ${PARENT_DIR}/background.xml

elif echo "${WEATHER}" | grep -E -i -q 'storm|thunder' ; then

    cp -f ${PARENT_DIR}/storm.xml ${PARENT_DIR}/background.xml

elif echo "${WEATHER}" | grep -i -q 'snow' ; then

    cp -f ${PARENT_DIR}/snow.xml ${PARENT_DIR}/background.xml

elif echo "${WEATHER}" | grep -i -q 'rain' ; then

    cp -f ${PARENT_DIR}/rain.xml ${PARENT_DIR}/background.xml

elif echo "${WEATHER}" | grep -i -q 'shower' ; then

    cp -f ${PARENT_DIR}/shower.xml ${PARENT_DIR}/background.xml

elif echo "${WEATHER}" | grep -i -q 'fog' ; then


    cp -f ${PARENT_DIR}/fog.xml ${PARENT_DIR}/background.xml

fi
ETAPE 3
Dans un terminal tapez la commande suivante
crontab -e
Ca à pour effet d'ouvrir un fichier (plus d'info ici: http://doc.ubuntu-fr.org/cron A la fin de ce fichier entrez la commande suivante
*/15 * * * * /home/votre_login/.dynbg/meteo.sh CODE_VILLE
Remplacez CODE_VILLE par le code de votre ville (comme préciser dans la 1 ere methode)
Redemarrez et voilà, votre script se relancera tous les 1/4 d'heure. Faites pointez gnome vers background.xml généré au redemarrage dans votre home/votre_login/.dynbg

METHODE DE KANOR

Je fais un copiez colez du topic donnez en lien au debus de ce post de kanor.

Télécharger l'archive (la c'est pas possible de le copier coller dans le forum tongue )
http://rdubreil.free.fr/WallDyn.tar.bz2
Rendez exécutable backgroundG
Cliquer dessus suivez les instruction (ou plus exactement essayé de suivre les instructions que je dois réécrire .. )

J'attends vos critique


Ah oui petit détail quand vous arrivez au niveau des case ou on peux rentrer longitute et latitude vous devez les écrire sous la forme décimal et non sexagésimal
Plus d'info ici
http://fr.wikipedia.org/wiki/Num%C3%A9ration_sexag%C3%A9simale
Essayez c'est une petit fonctionnalité sympa .


FICHIERS GRAPHIQUES:

Pour les fichiers graphiques, rendez-vous sur le post de sebco à la rubrique III/ L E S W A L L P A P E R D Y N A M I Q U E S M E T E O


Note: Sebco a mis aussi les scripts et les fichiers xml dans son pack. Il créé ses images sous extension jpg et mes scripts traitent des images aveec l'extension jpeg.
Donc soit vous ne prenez que les images (si vous avec déjà les scripts de ce tuto) et renommez les images de image.jpg en image.jpeg. Soit vous copiez tous son pack dans votre dossier background, et dans ce cas, mettez les à jours les fichiers xml avec cette commande
cd /home/votrenom/background
sed -i 's/sebco/votrenom/g' *.xml
MODIFICATION WEATHER.COM:
Attention, weather.com a modifié le site d'accès.
Voir le topic : http://forum.ubuntu-fr.org/viewtopic.php?pid=2796114

Il faut remplacer les xoap par xml dans les différents scripts.
Bonsoir,

Je suivais votre travail sur d'autre post et c'est vraiment génial.

Manque plus que de très très belles images reflétant le mieux possible le TEMPS qui passe.

Allez vite les graphistes ... 🙂

@+:cool:
Bonjour,

je suis également vos posts depuis le début et étant newb je n'ai pas résisté à l'envie de m'inscrire sur ce forum.
Il me tarde qu'un graphiste généreux passe par là pour inscrire son empreinte dans de belles images météo. Je fais çà de mon côté mais à mon niveau :/

voici le script pour ceux qui comme moi vont faire des copier coller des différents scripts proposés ci dessus. 🙂

http://membres.lycos.fr/karlmx/dev/newb/ubuntu/

il y a aussi l'archive qui regroupe tout çà...

!!
Karlmx, regarde l'Edit de mon premier post, une petite erreur dans les fichiers XML. Ce serait cool que tu corriges ceux que tu as mis en ligne. quand tu l'auras fait, je mettrai un lien vers ton adresse dans le premier post. MERKI!
Très bon projet,je suis impatient du rendu final 😃:D
emris
je ne me suis pas encore penché sur ton xml, mais voila --> exemple
je suis en pleine journée, il fait tres beau, puis le temp tourne orageux...la mise à jour par les script se fait en 1/4 d'heure... Jusque là ok. Mais, le changement de wall se fait-il en overlay? Ou s'opère-t-il sans transition?
je sais il suffit de chercher dans ton codage...mais moi et faignantise ne formons qu'un 😃
Heu... c'est intéressant comme idée ça Sebco. Non, le changement de wall s'opère sans transition quand c'est la météo qui change. Le script opère le changement à la "sauvage", en remplacant (dans ton exemp le) sunny.xml par storm.xml dans background.xml . Donc l'image "sautera" de soleil à orage.

Faudrait que je reflechisse à un moyen de le faire en animation, mais là comme ça, je vois pas trop. Bon aller grillons des cellules grises...
emris >> modification effectuée.

🙂
emris,changement de wall en transition serait pas mal.
Bon, les gars, j'en ai un , je verifie et je vous le livre...p'tain, 32 wall, c'est long...
Bon, il y a un probleme ...
Emris, le background.xml, il se crée tout seule ? Si oui, ou ? le .xslt doit il etre executable ?
Je verifie tout là !
Il y a un élément que je comprend pas dans la procédure de emric c'est son script
#/bin/bash
#Scipt à placer au demarage
RUNDIR=~/background

Verification(){
$RUNDIR/meteo1.sh XXXXX #Modifier XXXXX selon le dode de votre ville
$RUNDIR/meteo2.sh
}

Boucle(){
sleep 15m #le scipt verifiera la météo toutes les 15 minutes. Modifier la valeur à votre guise.
Verification
Boucle
}

Verification
Boucle
Ça ne ressemble pas à un script bash
verifification et boucle n'existe pas en bash !!
Oui, c'est aussi ce que je voyais, au départ je croyait que c'est lui qui generais le background.xml, mais j'en suis plus si sure, c'est les deux derniere ligne qui me parraisse bizarre.
Je vais voir avec lui
Kanor a écritIl y a un élément que je comprend pas dans la procédure de emric c'est son script
[...]
Ça ne ressemble pas à un script bash
verifification et boucle n'existe pas en bash !!
Ce sont des fonctions, qui sont définies quelques lignes au dessus 😉
Normalment ça devrait marcher comme ça
Tu lance le fichier meteo.sh
qui lance les deux autre script le premier script meteo.sh
permet de récupérer les donné de weather prb la ligne
 w3m -dump http://xoap.weather.com/weather/local/FRXX0114?cc=*&unit=m&dayf=2 | xsltproc ~/Customise_Linux/background/meteo.xslt > meteo.txt
Ne fonctionne pas chez moi
Aprés ça lance le script meteo2.sh
qui récupére le temps dans le fichier meteo.txt qui a été trouvé précédament .
Enfin ça te fait une copie d'un xml suivant la méteo trouvé vers un background

Edit Ah ok je viens de comprendre le truc pas révéllié merci iuchiban
Oui, oui, j'avais compris ça, mais le fait est que le background.xml ne se genere pas.
Je vais aller regarder du coté de Xplanet...J'ai envoyer un mail à Emris, il aura peut etre la solution...on verra bien...

Karlmx, est-ce-que ça fonctionne chez toi?
Sebco > euh... je suis encore au taff, je peux pas encore tester 😛, je mettrais mon test ce soir...

🙂