Programming Wiki: Download Clouds Script Mod

Programming Wiki : DownloadClouds

WikiHomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Download Clouds Script Mod

Python


Modifications to Michal Pasternak python script that downloads cloud maps for xplanet so that it will redownload about every 4 hours.


image
Bigger


Xplanet Web Site:
http://xplanet.sourceforge.net/
Download Cloud Map Scripts (perl and python):
http://xplanet.sourceforge.net/clouds.php

download_clouds.py changes
+++from time import sleep

+++while True:
.
.
.
    if time.time() - mtime < maxDownloadFrequencyHours * 3600 and fs > 400000:
        sys.stderr.write("File is already up to date!\n")
        ---sys.exit(0)
.
.
.
    # ok, download:
    +++if time.time() - mtime > maxDownloadFrequencyHours * 3600 or fs < 400000:
        for a in range(maxRetries):
            try:
                url = mirrors [ random.randint(0, len(mirrors)-1) ]
                sys.stderr.write("Using %s\nDownloading...\n" % url)
                urllib.urlretrieve(url, outputFile)
                break
            except:
                pass
            pass
        pass
   
    +++sleep(14500)


???Would this be less efficient than putting the old script in a cron job???


$ python download_clouds.py 2> /dev/null &

$ nice -n 19 xplanet -origin moon -config update_clouds.config -radius 50 -wait 120 &

or centered over the Americas

$ xplanet -longitude 270 -latitude 30 -radius 60 -config update_clouds.conf -nice 19 -wait 120 &

the configuration file: ~/.xplanet/default
[earth]
"Earth"
map=day_clouds.jpg
night_map=night_clouds.jpg
specular_map=earthspec.png # If you want reflection

For reflection specular reflection map

/.xplanet/update_clouds.config
map=day_map.jpg
night_map=night_map.jpg
cloud_map=clouds_2048.jpg


http://xplanet.sourceforge.net/clouds.php

There are no comments on this page. [Add comment]

Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.0269 seconds