n'guild Thu 09 Sep, 2010 [21:41 UTC]
Menu

Xplanet

print


C'est que ça pete, quand meme, faut dire, la terre en fond d'ecran avec la couche de nuages mise a jour toutes les 3 heures. Vu qu'on me demande ma conf, j'aime autant la publier.

  1. install
    a la debian
    apt-get install xplanet xplanet-images

  2. conf
    dans /etc/xplanet/config/default
    /etc/xplanet/config/default
    [default]
    arc_color=white
    cloud_gamma=1
    cloud_map=clouds.jpg
    cloud_ssec=false
    cloud_threshold=0
    color={255,255,255}
    draw_orbit=false
    grid=false      
    grid1=6
    grid2=15
    magnify=1
    marker_color=red
    max_radius_for_label=3
    min_radius_for_label=.01
    min_radius_for_markers=40
    orbit={-.5,.5,2}
    orbit_color={255,255,255}
    random_origin=true
    random_target=true
    shade=30
    text_color={255,0,0}
    twilight=6
    
    [earth]
    "Earth"
    color={28, 82, 110}

  3. cron
    /etc/crontab
    12 0/3 * * root perl /home/mose/bin/download_clouds.pl 2&> /dev/null

  4. script
    ~/bin/download_clouds.pl
    #!/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
    
    use LWP::Simple;
    
    # Set options:
    #  - where to save the downloaded file (default is current directory)
    my $Filename = "/usr/share/xplanet/images/clouds.jpg";
    
    # - how often the image is updated on the server
    my $MaxDownloadFrequencyHours = 2;
    
    # - how many times to retry, if the server doesn't respond
    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.
    ##
    ## Change these settings at the risk of being blacklisted from the
    ## image servers.
    
        
    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);
      } 
    } 
    
    sub GetRandomMirror() {
      my @Mirrors = (
         "ftp://mirror.pacific.net.au/pub2/xplanet/clouds_2048.jpg",
         "http://spierepf.dyndns.org/~peter/clouds_2048.jpg", 
         "http://liotierj.free.fr/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://rcswww.urz.tu-dresden.de/~es179238/clouds_2048.jpg",
         "http://home.megapass.co.kr/~jhkim1101/cloud_data/clouds_2048.jpg",
         "http://user.chol.com/~winxplanet/cloud_data/clouds_2048.jpg",
         "http://home.megapass.co.kr/~gitto88/cloud_data/clouds_2048.jpg",
         "http://myhome.hanafos.com/~hyoungkee/cloud_data/clouds_2048.jpg",
         "http://giga.forfun.net/clouds_2048.jpg", 
         "http://php.nctu.edu.tw/~ijliao/clouds_2048.jpg",
         "ftp://ftp.iastate.edu/pub/xplanet/clouds_2048.jpg",
         "http://www.nmt.edu/~houdini/clouds_2048.jpg", 
         "http://enekoalonso.com/projects/xplanet/clouds_2048.php",
         "http://xplanet.nerp.net/clouds_2048.php");
      return $Mirrors[rand scalar(@Mirrors)];
    } 
    

  5. images alternatives
    J'ai bricolé un peu les images de fond, pour obscurcir la terre de jour et donner une teinte verte matrixienne à la nuit. j'ai aussi fait une image de background avec un halo blanc sur fond noir (faut la redimensionner, la taille de l'image de fond est de 1920x1200).
    xplanet_bg.jpg night.jpg earth.jpg
  6. lancement
    ~.xinitrc
    xplanet -idlewait 30 -hibernate 600 -wait 120 -latitude 42 -longitude 2 -radius 42% -background ~/images/xplanet_bg.jpg &

Contributors to this page: mose904 points  .
Page last modified on Saturday 18 June, 2005 [02:55:14 UTC] by mose904 points .

or, for more interaction:
or
List of attached files
  name desc uploaded size >
1 : 11 icon xplanet_bg.jpg ~/images/xplanet_bg.jpg Thu 16 Jun, 2005 [16:08 UTC] by mose 104.67 Kb 1385
2 : 10 icon night.jpg /usr/share/xplanet/images/night.jpg Thu 16 Jun, 2005 [16:05 UTC] by mose 156.07 Kb 1186
3 : 9 icon earth.jpg /usr/share/xplanet/images/earth.jpg Thu 16 Jun, 2005 [16:05 UTC] by mose 193.08 Kb 1167
Search
in:
Search Wiki PageName
[ Execution time: 0.57 secs ]   [ Memory usage: 13.38MB ]   [ 39 database queries used ]   [ GZIP Enabled ]   [ Server load: 0.23 ]
Last update from CVS: Friday 26 October, 2007 [15:59:54 UTC]