Ceci est une ancienne révision du document !
XPlanet
XPlanet est un logiciel permettant de créer des images de notre système solaire.
Pré-requis
- Disposer des droits d'administration ;
- Disposer d'une connexion à Internet configurée et activée ;
- Avoir activé l'accès aux dépôts Universe et Multiverse ;
Installation et utilisation
Il vous suffit, pour cela, d'installer les paquets xplanet xplanet-images.
Vous pouvez ensuite l'utiliser, par exemple pour afficher Mars :
xplanet -window -body mars
XPlanet accepte de nombreuses options, man xplanet pour plus d'informations.
xplanet -window -geometry 600x400 -radius 40 -body mars -latitude 30
XPlanet comme fond d'écran dynamique
Il est possible d'utiliser XPlanet comme fond d'écran dynamique, c'est-à-dire mis à jour régulièrement. Par défaut, les scripts suivants affichent une image de la Terre mise à jour toutes les 10 minutes, avec des nuages mis à jour toutes les trois heures et les lumières des villes la nuit.
Installation
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 ; ne mettez pas de raccourci $HOME ou ~, ce n'est pas un script bash et ça ne fonctionnera pas !) :
#!/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)]; }
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
Utilisation
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.
Désinstallation
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
XPlanet comme écran de veille
Première solution
Créez un fichier texte nommé xplanet.desktop dans le répertoire /usr/share/applications/screensavers/ (/usr/share/gnome-screensaver/themes/ pour les versions d'Ubuntu antérieures à Edgy), et copiez-y les lignes suivantes :
[Desktop Entry] Encoding=UTF-8 Name=XPlanet Comment=Affiche des planètes du système solaire avec XPlanet. TryExec=xplanet Exec=xplanet -vroot -label -body random -origin random -radius 20 -range 10 -wait 30 StartupNotify=false Terminal=false Type=Application Categories=Screensaver X-Ubuntu-Gettext-Domain=xscreensaver
Créez un lien symbolique vers /usr/bin/xplanet dans /usr/lib/xscreensaver/ :
sudo ln -s /usr/bin/xplanet /usr/lib/xscreensaver/
L'écran de veille devrait apparaître dans la liste proposée dans le menu Système > Préférences > Écrans de veille.
Seconde solution
Ce script perl permet de configurer plus finement les paramètres de XPlanet, et également d'avoir des images un peu plus variées, pas simplement centrées avec une taille fixe.
Éditez un fichier texte nommé xplanet-xscreensaver dans le répertoire $HOME/.xplanet (créez le répertoire s'il n'existe pas déjà) et copiez-y les lignes suivantes :
#!/usr/bin/perl -w use strict; my $width = -1; my $height = -1; ## Add or delete objects and uncomment if you want only particular objects. Don't forget to uncomment the selection in newimg(). #my @body_liste = ("sun", "mercury", "venus", "earth", "moon", "mars", # "phobos", "deimos", "jupiter", "io", "europa", "ganymede", # "callisto", "saturn", "mimas", "enceladus", "tethys", "dione", # "rhea", "titan", "hyperion", "iapetus", "phoebe", "uranus", # "miranda", "ariel", "umbriel", "titania", "oberon", "neptune", # "triton", "nereid", "pluto", "charon", "major"); sub newimg { ## Randomize the center of the image. my $center_x = int(rand()*$width); my $center_y = int(rand()*$height); ## Randomize the size of objects. my $radius = rand()*65+5; ## Random coordinates and north angle, you can fix them if you wish. Random values as set here are equivalent to -random option. # my $long = rand()*360-180; # my $lat = rand()*180-90; # my $angle = rand()*360; ## Comment the following line and uncomment the next one if you wish to use a custom list of objects. my $body = "random"; # my $body = $body_liste[rand scalar(@body_liste)]; my $cmd = "xplanet -vroot -num_times 1 -quality 100 "; $cmd .= " -center +$center_x+$center_y "; $cmd .= " -body $body -radius $radius "; ## Uncomment the following line and comment the next one if you want to fix the view. # $cmd .= " -longitude $long -latitude $lat -rotate $angle "; $cmd .= " -random "; $cmd .= " -starmap BSC -base_magnitude 120 "; $cmd .= " -label -fontsize 15 "; system ($cmd); } sub main { $_ = `xdpyinfo 2>&-`; ($width,$height) = m/ dimensions: +(\d+)x(\d+) pixels/; ($width,$height) = (640,480) unless ($width>0 && $height>0); while (1) { newimg(); sleep 5; } } main; exit 0;
Rendez-le exécutable :
chmod +x $HOME/.xplanet/xplanet-xscreensaver
Enfin, éditez le fichier $HOME/.xscreensaver et ajoutez-y la ligne suivante dans la section « programs: » :
"XPlanet" /usr/bin/perl $HOME/.xplanet/xplanet-screensaver \
L'écran de veille devrait maintenant apparaître dans la liste proposée dans le menu Système > Préférences > Écrans de veille.
Voir aussi
Programme
Position
- (fr) Longitude wikipédia