Ceci est une ancienne révision du document !



Xplanet

Xplanet permet d'utiliser comme fond d'écran une des planètes de notre système solaire, dont la Terre avec ses nuages et la limite entre le jour et la nuit.

L'image est mise à jour à intervalle régulier.

Il vous suffit, pour cela, d'installer les paquets xplanet xplanet-images.

Installer en 1 clic
Installer en 1 clic.

Tout d'abord, si il n'existe pas, créer le répertoire de xplanet. Dans une console lancez la commande :

if [ ! -d ~/.xplanet ]; then echo 'Create .xplanet'; mkdir -p ~/.xplanet/images ; fi

Ensuite, récupérer les fichiers xplanet-bg et clouds.pl en copiant-collant les listing ci-dessous. Le fichier xplanet-bg contient la configuration de xplanet: position, projection, répertoires, … et clouds.pl la configuration et la récuperation de l'image des nuages.
Éditez les fichiers et enregistrez les respectivement comme /usr/local/bin/xplanet-bg et /usr/local/bin/clouds.pl.

Les options sont expliquées dans les fichiers.

xplanet-bg :

#!/bin/bash
# xplanet-gnome.sh shell script v0.2
# Montre la Terre sur le bureau Gnome avec les condition courante d'éclairage,ex: le jour et la nuit

# délai de mise à jour en minutes
DELAY=10m

# Répertoire racine de xplanet
PREFIX=~/.xplanet/

# Non du fichier images créer
OUTPUT=xplanet.png

# origine et look_at ne peuvent etre les mêmes
# modifier ORIGINE pour donner la planete d'où vous regardez 
# modifier LOOK_AT pour changer la planete que vous regardez
ORIGINE=moon
LOOK_AT=earth

APPEND=2


# Géométrie de l'image à régler suivant la résolution du bureau
GEOMETRY=1280x1024

# Position depuis où vous voulez regarder.
# Pour trouver la valeurs regarder dans les liens en fin de la page
# http://doc.ubuntu-fr.org/xplanet#Voir_aussi
# Nice  L = 43.700°    43° 42'N; H = 7.266274°    7° 15′E
LONGITUDE=7
LATITUDE=43

# Par defaut il n'y as pas de projection. Rendre un globe avec la projection rectangulaire en fait une carte à plat. vous pouvez aussi essayer : ancient, azimuthal,  mercator,..
#PROJECTION=rectangular  

# Renome l'image de fond ainsi Gnome réalise que l'image as changé - thx to dmbasso

if [ -e "$PREFIX$OUTPUT" ]; then
   rm "$PREFIX$OUTPUT"
   OUTPUT="$APPEND$OUTPUT"
else
   rm "$PREFIX$APPEND$OUTPUT"
fi

if [ -z $PROJECTION ]; then 
xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -origin $ORIGINE -body $LOOK_AT -longitude $LONGITUDE -latitude $LATITUDE
else
xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -origin $ORIGINE -body $LOOK_AT -longitude $LONGITUDE -latitude $LATITUDE -projection $PROJECTION
fi

# met à jour le fond d'écran de Gnome
gconftool -t str -s /desktop/gnome/background/picture_filename "$PREFIX$OUTPUT"

sleep $DELAY
exec $0

clouds.pl à la ligne 34 remplacer $user par votre nom d'utilisateur :

#!/usr/bin/perl
# ------------------------------------------------------------------------------------
#  Program for downloading XPlanet cloud images from a random mirror
# 
#  Copyright (c) 2003, cueSim Ltd.                  http://www.cueSim.com, Bedford, UK
#  
# ------------------------------------------------------------------------------------
#  
#  Redistribution and use, with or without modification, are permitted provided 
#  that the following conditions are met:
#  
#      * Redistributions of source code must retain the above copyright notice, 
#     this list of conditions and the following disclaimer.
#      * Neither the cueSim name nor the names of its contributors may 
#     be used to endorse or promote products derived from this software without 
#     specific prior written permission.
#  
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
#  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
#  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
#  SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
#  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
#  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 
# (2005-06) hacked by mose at nguild.org for personal use on a debian SID
# (2008-08) hacked by benhaim_jerome at yahoo.fr for personal use on a ubuntu Hardy

use LWP::Simple;

# Options:
#  - ou sauvegarder l'image des nuages (par defaut le répertoire courant)
# 

my $Filename = "/home/$user/.xplanet/images/clouds.jpg";

# - fréquences de mise à jour de l'image sur le serveur
my $MaxDownloadFrequencyHours = 2;

# - Combien d'essais, si le serveur ne répond pas 
my $MaxRetries = 3;

## Note: excessive requests to a single image server is discouraged.
## This script limits max retries, does not download more frequently
## than every two hours (the file is generated every 3 hours). and 
## picks a random mirror location for every download.
##
## Changer les paramètres risque de vous exclure (blacklisted)
## des serveurs d'images
    
if(-f $Filename) {
  my @Stats = stat($Filename);
  my $FileAge = (time() - $Stats[9]);
  my $FileSize = $Stats[7];
  if($FileAge < 60 * 60 * $MaxDownloadFrequencyHours && $FileSize > 400000) {
    print "File is already up to date\n";
    exit(1);
  }
}

for(1..$MaxRetries) {
  my $MirrorURL = GetRandomMirror();
  print "Using $MirrorURL\nDownloading...\n";
  my $Response = getstore($MirrorURL, $Filename);
  if( IndicatesSuccess($Response)) {
    print "Finished: file successfully downloaded to $Filename\n";
    exit(0);
  }
  print "Download not available, trying another website\n\n";
}
print "ERROR: Tried to download the file $MaxRetries times, but no servers could provide the file\n";
exit(2);

sub IndicatesSuccess() {
  my $Response = shift();
  if($Response =~ /2\d\d/) {
    return(1); 
  } else {
    return(0);
  } 
} 
## Liste des serveurs miroir
sub GetRandomMirror() {
  my @Mirrors = (
     "http://xplanet.sourceforge.net/clouds/clouds_2048.jpg",
     "http://www.ruwenzori.net/earth/clouds_2048.jpg",
     "http://xplanet.dyndns.org/clouds/clouds_2048.jpg",
     "http://userpage.fu-berlin.de/~jml/clouds_2048.jpg",
     "http://userpage.fu-berlin.de/~jml/clouds_4096.jpg",
     "http://php.nctu.edu.tw/~ijliao/clouds_2048.jpg",
     "http://home.megapass.co.kr/~gitto88/cloud_data/clouds_2048.jpg",
     "http://home.megapass.co.kr/~holywatr/cloud_data/clouds_2048.jpg",
     "ftp://ftp.iastate.edu/pub/xplanet/clouds_2048.jpg",
     "http://xplanet.explore-the-world.net/clouds_2048.jpg",
     "ftp://mirror.pacific.net.au/xplanet/clouds_2048.jpg",
     "http://www.narrabri.atnf.csiro.au/operations/NASA/clouds_2048.jpg",
  );
  return $Mirrors[rand scalar(@Mirrors)];
}
La liste des serveurs à la fin du fichier clouds.pl n'est pas forcément à jour. Il est important d'avoir une liste à jours pour éviter des requêtes inutiles vers des serveurs qui n'existent plus. Assurez-vous que les serveurs sont dans la liste disponible ici (ce n'est pas la peine de vérifier régulièrement, faites-le juste lors de l'installation).

Editez le fichier /etc/xplanet/config/default:

gksudo gedit /etc/xplanet/config/default

et rajoutez cloud_map=clouds.jpg dans la section [Earth] et cloud_threshold=0 :

# This file contains options you might want to customize for each
# body.  It's best to leave this file alone and modify a copy. Use the
# -config option to tell xplanet to read your copy.

[default]                       # Values in this section apply to all
				# bodies unless overridden below.   

arc_color=white
#arc_file=

#bump_map=
bump_scale=1

cloud_gamma=1

cloud_ssec=false                # true if the cloud map is from the
				# University of Wisconsin Space
				# Science and Engineering Center 
cloud_threshold=0

color={255,255,255}             # fallback color in case an image map
				# isn't found 

draw_orbit=false                # if true, draw this body's orbit
                                # about its primary

grid=false
grid1=6
grid2=15

#image=

magnify=1                       # draw the body as if its radius were
				# magnified by this factor 

marker_color=red
#marker_file=
#marker_font=

max_radius_for_label=3          # don't draw a label if the body's
				# radius in pixels is more than this  

min_radius_for_label=.01        # don't draw a label if the body's
				# radius in pixels is less than this  

min_radius_for_markers=40       # don't draw markers if the body's
				# radius in pixels is less than this  

#night_map=

orbit={-.5,.5,2}                # extent of orbit to draw, 
				# {start, end, delta}, where 
                                # start and end are in units of period
				# of revolution and delta is angular
				# increment in degrees to evaluate
				# position 

orbit_color={255,255,255}       # color for the orbit

random_origin=true              # Can this body be considered if
				# -origin random is used?  

random_target=true              # Can this body be considered if
				# -target random is used?  

#satellite_file=

shade=30                        # 0 = black, 100 = same as dayside

#specular_map=

text_color={255,0,0}            # color for text (markers & body label)

twilight=6                      # blend the day and night images for
                                # pixels within this many degrees of
                                # the terminator 

[sun]
"Sun"
color={255,255,166}

max_radius_for_label=0          # never draw a label for the sun

shade=100			# No night side!

[mercury]
"Mercury"
color={100, 100, 100}

min_radius_for_label=0          # always draw a label

[venus]
"Venus"
color={161, 129, 70}

min_radius_for_label=0

[earth]
"Earth"
color={28, 82, 110}
cloud_map=clouds.jpg
# I have day and night maps of Australia centered on Alice Springs,
# which are cropped from higher resolution maps.
#map=alice_springs.png
#night_map=alice_springs_night.png
#mapbounds={-1.2,98.7107,-46.2,169.023}  # lat1, lon1, lat2, lon2

#marker_file=earth

min_radius_for_label=0

#satellite_file=iss

[moon]
"Moon"
color={100, 100, 100}

[mars]
"Mars"
color={172, 123, 67}

min_radius_for_label=0

[phobos]
"Phobos"

[deimos]
"Deimos"

[jupiter]
"Jupiter"
color={204, 163, 133}
min_radius_for_label=0

[io]
"Io"
color={212, 182, 52}

[europa]
"Europa"
color={140, 140, 140}

[ganymede]
"Ganymede"
color={150, 150, 150}

[callisto]
"Callisto"
color={70, 70, 70}

[saturn]
"Saturn"
color={244, 199, 134}
min_radius_for_label=0

[mimas]
"Mimas"

[enceladus]
"Enceladus"

[tethys]
"Tethys"

[dione]
"Dione"

[rhea]
"Rhea"

[titan]
"Titan"

color={252,94,7}

[hyperion]
"Hyperion"

[iapetus]
"Iapetus"

[phoebe]
"Phoebe"

[uranus]
"Uranus"

color={105, 197, 238}

min_radius_for_label=0

[miranda]
"Miranda"

[ariel]
"Ariel"

[umbriel]
"Umbriel"

[titania]
"Titania"

[oberon]
"Oberon"

[neptune]
"Neptune"
color={95, 133, 232}

min_radius_for_label=0

[triton]
"Triton"

[nereid]
"Nereid"

[pluto]
"Pluto"
color={206, 180, 153}

min_radius_for_label=0

[charon]
"Charon"

Puis rendre executable le fichier xplanet-bg :

sudo chmod +x /usr/local/bin/xplanet-bg

Et modifiez la table de cron :

crontab -e

Ajoutez-y à la fin en modifiant $USER par le nom de votre utilisateur:

49 2,5,8,11,14,17,20,23 * * * $USER perl /usr/local/bin/clouds.pl

Pour qu'il se lance automatiquement à l'ouverture de session:

  • sous gnome, dans le menu "Système » Préférences » Sessions" rajouter une entrée comme suis:
    • Nom : xplanet
    • Commande : /usr/local/bin/xplanet-bg
    • Commentaires : Fond d'écran planétaire

Validez et fermez.

Pour supprimer cette application, il suffit de :

  • supprimer son paquet. La configuration de l'application sera conservée ou supprimée selon la méthode de désinstallation que vous choisirez.
  • Dans gnome, dans le menu "Système » Préférences » Sessions" supprimer l'entrée xplanet.
  • éditez les fichiers gksudo gedit /etc/crontab et supprimez ou commentez la ligne ainsi :
# 49 2,5,8,11,14,17,20,23 * * * $USER perl /usr/local/bin/clouds.pl
  • supprimer les dossier dans le répertoire utilisateur :
rm -Rf ~/.xplanet

Programme

Posistion

Cartes des planètes

  • xplanet.1218615781.txt.gz
  • Dernière modification: Le 15/08/2008, 18:53
  • (modification externe)