# [Gelöst]xplanet installieren

## Hanisch

Hallo,

ich habe mir das Paket 'xplanet' installiert, um die Erde mit aktueller Wolkenbildung als Desktop-Hintergrundbild zu verwenden.

Leider funktioniert das Herunterladen der aktuellen Wolkenbildung nach /home/opa/.xplanet/clouds.jpg nicht.

Wenn ich das Script /home/opa/.xplanet/xplanet.2.sh starte erhalte ich:

```
~/.xplanet $ sh /home/opa/.xplanet/xplanet.2.sh

rm: das Entfernen von „/home/opa/.xplanet/clouds.jpg“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden

Can't locate LWP/Simple.pm in @INC (@INC contains: /etc/perl /usr/lib/perl5/site_perl/5.12.4/i686-linux /usr/lib/perl5/site_perl/5.12.4 /usr/lib/perl5/vendor_perl/5.12.4/i686-linux /usr/lib/perl5/vendor_perl/5.12.4 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.12.4/i686-linux /usr/lib/perl5/5.12.4 /usr/local/lib/site_perl .) at /home/opa/.xplanet/download_clouds.pl line 30.

BEGIN failed--compilation aborted at /home/opa/.xplanet/download_clouds.pl line 30.

Warning: Can't find clouds.jpg in

xplanet/images

/home/opa/.xplanet/images

/usr/share/xplanet/images

Warning: Can't load map file clouds.jpg

Changed image (14 °/ 52 °)
```

Der Inhalt von xplanet.2.sh ist:

```
#!/bin/bash

# xplanet-gnome.sh shell script v0.4

# shows Earth on your Gnome desktop with current lighting conditions,i.e. day and night

# ChangeLog

# Version 0.4

# >  If rotating counterclockwise it now reset LONGITUDE if it <= -360°

# Version 0.3

# >  Added comments

# >  Rotating planet (one frame per minute default)

# >  Background option included

# >  Debugging option/output

# >  When changing background it generates first the background and deletes then the old file

# Remove "#" to activate clouds (need the script)

rm ~/.xplanet/clouds.jpg

perl $HOME/.xplanet/download_clouds.pl 

# set the delay (default 1 minute)

DELAY=2m

# set the delay if the globus isn't rotating (default 30 minutes)

# could be removed if rtating is always on

NOROTATINGDELAY=30m

# Background file

#BACKGROUND=

PREFIX=$HOME/.xplanet/images/

OUTPUT=xplanet.png

APPEND=2

# sets the numbers of longitudes added each "frame"

# "rotating speed" - if 0 then rotating is deactivated [-360 .. 360]

SPEED=10

# geometry of the desktop

#GEOMETRY=800x640

GEOMETRY=1440x900

# between 0 and 359 (left/right)

LONGITUDE=14

# between -90 and 90 (Southpole .. Northpole)

LATITUDE=52

# default is no projection,i.e. render a globe

# rectangular is the flat world map. also try ancient, azimuthal,  mercator,..

#PROJECTION=rectangular  

# if debugging is activated the console prints echos ["on" / "off"]

DEBUGGING="off"

#rename background image so Gnome realises image has changed - thx to dmbasso

if [ "$*" != "" ]; then

  let "LONGITUDE=$1"

fi

if [ $LONGITUDE -ge 360 ] || [ $LONGITUDE -le 360 ]; then

  let "LONGITUDE%=360"

  if [ $DEBUGGING = "on" ]; then

    echo "Set LONGITUDE on LONGITUDE modulo 360"

  fi

fi

if [ -e "$PREFIX$OUTPUT" ]; then

   RMFILE="$PREFIX$OUTPUT"

   OUTPUT="$APPEND$OUTPUT"

else

   RMFILE="$PREFIX$APPEND$OUTPUT"

fi

if [ $DEBUGGING = "on" ]; then

  echo "Changed file and file to removed"

  echo "New filename: $PREFIX$OUTPUT"

fi

if [ -z $PROJECTION ]; then 

  if [ -z $BACKGROUND ]; then

    xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE

  else

    xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -background $BACKGROUND

  fi

else

  if [ -z $BACKGROUND ]; then

    xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -projection $PROJECTION

  else

    xplanet -num_times 1 -output "$PREFIX$OUTPUT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -projection $PROJECTION -background $BACKGROUND

  fi

fi

if [ $DEBUGGING = "on" ]; then

  echo "Logitude: $LONGITUDE"

  echo "Latitude: $LATITUDE"

fi

#update Gnome backgound

echo "Changed image ($LONGITUDE °/ $LATITUDE °)"

gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$PREFIX$OUTPUT"

# delete old file

if [ -e "$RMFILE" ]; then

  rm $RMFILE

  if [ $DEBUGGING = "on" ]; then

    echo "File removed: $RMFILE"

  fi

else

  echo "File set to removed doesn't exists: $RMFILE"

fi

# if speed is not 0 it's rotating

if [ $SPEED != 0 ]; then

  # add speed to longitude

  let "LONGITUDE+=$SPEED"

else

  # set the no-rot-delay if rotating is deactivating

  # doesn't needed so much updates

  DELAY= $NOROTATINGDELAY

fi

cp $PREFIX$OUTPUT ~/.cache/Background/xplanet.png

# waiting the delay time

sleep $DELAY

exec $0 $LONGITUDE
```

Woran kann das liegen, in anderen Distributionen funktioniert es.

```
~/.xplanet $ /home/opa/.xplanet/download_clouds.pl

bash: /home/opa/.xplanet/download_clouds.pl: /usr/bin/perl^M: Defekter Interpreter: Datei oder Verzeichnis nicht gefunden

~/.xplanet $ sh /home/opa/.xplanet/download_clouds.pl

/home/opa/.xplanet/download_clouds.pl: Zeile 28: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 29: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 30: use: Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 30: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 31: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 34: my: Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 34: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 35: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 37: my: Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 37: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 38: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 40: my: Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 40: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 41: $'\r': Kommando nicht gefunden.

/home/opa/.xplanet/download_clouds.pl: Zeile 50: Syntaxfehler beim unerwarteten Wort `"/home/opa/.xplanet/"'

/home/opa/.xplanet/download_clouds.pl: Zeile 50: `chdir("/home/opa/.xplanet/") o' die("Couldn't change location.");
```

Mit folgendem Inhalt von /home/opa/.xplanet/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.

# 

use LWP::Simple;

# Set options:

#  - where to save the downloaded file (default is current directory)

my $Filename = "clouds.jpg";

# - how often the image is updated on the server

my $MaxDownloadFrequencyHours = 1;

# - 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.

chdir("/home/opa/.xplanet/") or die("Couldn't change location.");      

      

# Get file details

if(-f $Filename)

{

   my @Stats = stat($Filename);

   my $FileAge = (time() - $Stats[9]);

   my $FileSize = $Stats[7];

   # Check if file is already up to date

   if($FileAge < 60 * 60 * $MaxDownloadFrequencyHours && $FileSize > 200000)

   {

      print "File is already up to date\n";

      exit(1);   

   }

}

# Try several times to download the file if necessary

for(1..$MaxRetries)

{

   # Get a random website to hit for the file

   my $MirrorURL = GetRandomMirror("mirrors.txt");

   # Download the file

   print "Using $MirrorURL\nDownloading...\n";

   my $Response = getstore($MirrorURL, $Filename);

   # If successfully downloaded, that's it, nothing more to do

   if( IndicatesSuccess($Response))

   {

      print "Finished: file successfully downloaded to $Filename\n";

      exit(0);

   }

   

   # Warning that we're retrying another random server

   print "Download not available, trying another website\n\n";

}

# Warning that no servers could be contacted

print "ERROR: Tried to download the file $MaxRetries times, but no servers could provide the file\n";

exit(2);

# Return codes of 200 to 299 are "success" in HTTP-speak

sub IndicatesSuccess()

{

   my $Response = shift();

   if($Response =~ /2\d\d/)

   {

      return(1);

   }

   else

   {

      return(0);

   }

}

# Returns the name of an internet resource which can provide the clouds image

sub GetRandomMirror()

{

   # Populate a list of mirrors

   my @Mirrors = (

             "ftp://mirror.pacific.net.au/pub2/xplanet/clouds_2048.jpg",

             "http://www.ruwenzori.net/earth/clouds_2048.jpg",

             "http://xplanet.arculeo.com/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/~ysy00/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://home.megapass.co.kr/~holywatr/cloud_data/clouds_2048.jpg",

             "http://www.wizabit.eclipse.co.uk/xplanet/files/mirror/clouds_2048.jpg",

             "ftp://ftp.iastate.edu/pub/xplanet/clouds_2048.jpg",

             "http://xplanet.explore-the-world.net/clouds_2048.jpg");

   

   # Return one at random

   return $Mirrors[rand scalar(@Mirrors)];

}

```

Liegt es etwa an dem #!/usr/bin/perl ?

Folgendes funktioniert nicht:

```
~/.xplanet $ perl $HOME/.xplanet/download_clouds.pl

Can't locate LWP/Simple.pm in @INC (@INC contains: /etc/perl /usr/lib/perl5/site_perl/5.12.4/i686-linux /usr/lib/perl5/site_perl/5.12.4 /usr/lib/perl5/vendor_perl/5.12.4/i686-linux /usr/lib/perl5/vendor_perl/5.12.4 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.12.4/i686-linux /usr/lib/perl5/5.12.4 /usr/local/lib/site_perl .) at /home/opa/.xplanet/download_clouds.pl line 30.

BEGIN failed--compilation aborted at /home/opa/.xplanet/download_clouds.pl line 30
```

.

Gruß

Ch. HanischLast edited by Hanisch on Fri May 24, 2013 2:26 pm; edited 1 time in total

----------

## Hanisch

Hallo,

 *Quote:*   

> 
> 
> ...
> 
> Folgendes funktioniert nicht:
> ...

 

----------

## cryptosteve

Und unter welcher Oberfläche setzt Du das ein? Ich habe das seinerzeit mal unter KDE3, meinte aber, die Funktion wäre unter KDE4 weggefallen. Allerdings habe ich auch nie wieder ernsthaft danach gesucht.

----------

## Hanisch

 *cryptosteve wrote:*   

> Und unter welcher Oberfläche setzt Du das ein? Ich habe das seinerzeit mal unter KDE3, meinte aber, die Funktion wäre unter KDE4 weggefallen. Allerdings habe ich auch nie wieder ernsthaft danach gesucht.

 

Unter KDE.

Allerdings braucht es dazu noch ein weiteres Script, z.B. in ~/usr//xplanet-img/xplanet-img.sh mit folgendem Inhalt:

```
#/bin/bash

xplanet -window -geometry 1440x900 --num_times 1 --lon 14.1942 --lat 51.7727 --radius 40 --range 10 --output ~/usr/xplanet-img/pic.jpg && mv ~/usr/xplanet-img/pic.jpg ~/usr/xplanet-img/xplanet.jpg 
```

Und dann noch ein Verzeichnis ~/.cache/Background

Mit diesem Script wird der Erdball auf dem KDE-Desktop dargestellt und mit dem Script ~/.xplanet/xplanet.2.sh werden die Wolken aktualisiert, was unter GNOME ausreichend war.

Ich habe mir für KDE beide Scripts zu einem zusammengestellt in ~/.xplanet/xplanet-KDE.sh mit folgendem Inhalt:

 *Quote:*   

> #!/bin/bash
> 
> # xplanet-gnome.sh shell script v0.4
> 
> # shows Earth on your Gnome desktop with current lighting conditions,i.e. day and night
> ...

 

Das Verzeichnis ~/usr/xplanet-img dienst zur Aufnahme von weiteren Hintergrundbildern, die ich über eine Diashow anzeigen lasse.

Zur Konfiguration siehe http://joffie.swal.org/xplanet/

In ~/.xplanet/default muß noch die Zeile eingefügt werden:

```
...

[earth]

cloud_map=clouds.jpg

"Earth"

color={28, 82, 110}
```

Viel Erfolg beim Ausprobieren.

Mich würde noch interessieren, wie man diese beiden Scripte in einen CRON-Job stellen kann. Hat da jemand Vorschläge?

Gruß

Ch. HanischLast edited by Hanisch on Mon May 27, 2013 3:54 pm; edited 2 times in total

----------

## Max Steel

 *Hanisch wrote:*   

> Mich würde noch interessieren, wie man diese beiden Scripte in einen CRON-Job stellen kann. Hat da jemand Vorschläge?

 

Bei mir ist vixie-cron installiert, Dort reicht es die crontab des users entsprechend anzupassen. (crontab -e öffnet die User-Crontabs)

crontab -e

```
# Minute | Stunde | Tag des Monats | Monat des Jahres | Wochentag des Monats (0 - 7; 0 und 7 ist Sonntag) | [ausführender User (nur in der /etc/crontab)] | Script zum ausführen)

59 * * * *       /pfad/zum/script.sh       #Stündliches auführen

9 3 * * *    /pfad/zum/script.sh     # Tägliches Ausführen um 03:09 Uhr

19 4 * * 6 /pfad/zum/script.sh    # Wöchentliches Ausführen am Freitag um 04:19 Uhr

29 5 1 * * /pfad/zum/script.sh    # Monatliches Ausführen am 1. des Monats

*/10 * * * /pfad/zum/script.sh     # Alle 10 Minuten ausführen.
```

Hilfe dazu gibts auch in der crontab(5) manpage.

----------

