Contents

[edit] Info

A A Weather Screenlet modified from the original to look more clear and to enable the use of icon pack , you can use any icon pack compatible with weather.com , you can find many packs on deviantart.com or http://liquidweather.net/icons.php#iconsets.

by Helder Fraga aka Whise based on Weather Screenlet by robgig1088


[edit] Installation

Install as usual by extracting the contents of the screenlet's archive to the directory "$HOME/.screenlets".


[edit] Requirements

Requires no additional libaries. Runs with the default installation. (Put the requirements for your own screenlet here)


[edit] Usage

go on www.weather.com and search the name of your city , then click it , then on the url you will get something like http://www.weather.com/...=*******(* = Code) , the **** is your zip code copy it into the screenlet and your set


[edit] Discussion

I think there is a network problem with weather.com and this screenlet. Reading at enigma_OZ at http://forum.compiz-fusion.org/showthread.php?t=8137&highlight=weather, and modifying his patch (I removed &prod=xoap option in the urlopen lines) I solved the problem.

Apply patch with "patch < file" in the ClearWeather directory installation

Patch Code:

---- ClearWeatherScreenlet.py	2008-04-03 14:57:21.000000000 -0400
+++ ClearWeatherScreenlet.py	2008-04-30 09:22:08.000000000 -0400
@@ -119,7 +119,7 @@
 		temp = self.parseWeatherData()
 		temp2 = self.parseWeatherDataHourly()
 		
-		if temp[0]["where"] == '':    ##did we get any data?  if not...
+		if len(temp) == 0 or temp[0]["where"]  == '':    ##did we get any data?  if not...
 			if self.show_error_message==1 and self.updated_recently == 1:
 				self.show_error()
 			self.updated_recently = 0
@@ -137,19 +137,23 @@
 			unit = 'm'
 		else:
 			unit = 's'
-		data = urlopen('http://xoap.weather.com/weather/local/'+self.ZIP+'?cc=*&dayf=10&prod=xoap&par=1003666583&key=4128909340a9b2fc&unit='+unit).read()
+
 		forecast = []
+		try:
+			data = urlopen('http://xoap.weather.com/weather/local/'+self.ZIP+'?cc=*&dayf=10&par=1003666583&key=4128909340a9b2fc&unit='+unit).read()
 
-		dcstart = data.find('<loc ')
-		dcstop = data.find('</cc>')     ###### current conditions
-		data_current = data[dcstart:dcstop]
-		forecast.append(self.tokenizeCurrent(data_current))
-
-		for x in range(10):
-			dcstart = data.find('<day d=\"'+str(x))
-			dcstop = data.find('</day>',dcstart)   #####10-day forecast
-			day = data[dcstart:dcstop]
-			forecast.append(self.tokenizeForecast(day))
+			dcstart = data.find('<loc ')
+			dcstop = data.find('</cc>')     ###### current conditions
+			data_current = data[dcstart:dcstop]
+			forecast.append(self.tokenizeCurrent(data_current))
+
+			for x in range(10):
+				dcstart = data.find('<day d=\"'+str(x))
+				dcstop = data.find('</day>',dcstart)   #####10-day forecast
+				day = data[dcstart:dcstop]
+				forecast.append(self.tokenizeForecast(day))
+		except IOError, e:
+			print "Error retreiving Weather Data", e
 
 		return forecast
 
@@ -159,14 +163,17 @@
 			unit = 'm'
 		else:
 			unit = 's'
-		data = urlopen('http://xoap.weather.com/weather/local/'+self.ZIP+'?cc=*&dayf=10&prod=xoap&par=1003666583&key=4128909340a9b2fc&unit='+unit+'&hbhf=12').read()
-		hforecast = []
 
-		for x in range(8):
-			dcstart = data.find('<hour h=\"'+str(x))
-			dcstop = data.find('</hour>',dcstart)   ####hourly forecast
-			hour = data[dcstart:dcstop]
-			hforecast.append(self.tokenizeForecastHourly(hour))
+		hforecast = []
+		try:
+			data = urlopen('http://xoap.weather.com/weather/local/'+self.ZIP+'?cc=*&dayf=10&par=1003666583&key=4128909340a9b2fc&unit='+unit+'&hbhf=12').read()
+			for x in range(8):
+				dcstart = data.find('<hour h=\"'+str(x))
+				dcstop = data.find('</hour>',dcstart)   ####hourly forecast
+				hour = data[dcstart:dcstop]
+				hforecast.append(self.tokenizeForecastHourly(hour))
+		except IOError, e:
+			print "Error retrieving weather data", e
 
 		return hforecast

___________________________________________________________________________

If something is wrong, please contact me at [daviti at gmail dot com]
Clear Weather Screenlet

A Weather Screenlet

AuthorWhise
Version0.0.3
API Version0.0.9
Download[1]

Image:clearweather.JPG