#!/usr/bin/perl # Copyright (c) 2006 John Graham-Cumming # This file wraps xplanet to produce a background image in GNOME that # shows the following: # # The time in various cities around the world # A rectangular view of the entire world # Night time imagery where it is currently dark # Day time imagery adjusted for the correct season where it is light # The weather in the same cities from wunderground.com use strict; use LWP::Simple; my $root = '/tmp/'; my @images = ( 'xplanet1.png', 'xplanet2.png' ); my $screen = '1400x1050'; my $projection = 'rectangular'; my ( $latitude, $longitude ) = ( 30, 15 ); my $config = 'config'; my $marker = 'marker'; my $update = 60; my $image = 0; open CONFIG, ">$root$config"; print CONFIG< { lat => 51.50, lon => -0.17, tz => 'Europe/London', loc => '03772', con => '' }, Paris => { lat => 48.87, lon => 2.33, tz => 'Europe/Paris', loc => '07157', con => '' }, Tokyo => { lat => 35.75, lon => 139.50, tz => 'Asia/Tokyo', loc => '47671', con => '' }, 'New York' => { lat => 40.70, lon => -74.00, tz => 'America/New_York', loc => 'NY/New_York', con => '' }, 'Los Angeles' => { lat => 34.05, lon => -118.23, tz => 'America/Los_Angeles', loc => 'CA/Los_Angeles', con => '' }, Helsinki => { lat => 60.13, lon => 25.00, tz => 'Europe/Helsinki', loc => '02974', con => '' }, 'Buenos Aires' => { lat => -34.67, lon => -58.50, tz => 'America/Buenos_Aires', loc => '87582', con => '' }, Tunis => { lat => 36.83, lon => 10.22, tz => 'Africa/Tunis', loc => '60715', con => '' }, 'Hong Kong' => { lat => 22.30, lon => 114.17, tz => 'Asia/Hong_Kong', loc => '45007', con => '' }, ); my $weather_countdown = 0; while ( 1 ) { my $uptime = `uptime`; chomp $uptime; if ( $weather_countdown == 0 ) { get_all_weather(); $weather_countdown = 30; } --$weather_countdown; open MARKER, ">$root$marker"; print MARKER<