slackbuilds_ponce/desktop/CurseTheWeather/CurseTheWeather-0.6-patch
Phillip Warner c93efb0c0e desktop/CurseTheWeather: Updated patch.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2014-11-23 10:55:41 +07:00

88 lines
3.7 KiB
Text

diff -Naur CurseTheWeather-0.6-orig/ctw CurseTheWeather-0.6/ctw
--- CurseTheWeather-0.6-orig/ctw 2009-10-05 10:46:02.000000000 -0400
+++ CurseTheWeather-0.6/ctw 2014-11-22 16:29:05.803956562 -0500
@@ -183,19 +183,19 @@
forecastWindowsCreated = True
day = 0
dayWindows = []
- while day < 5:
+ while day < 10:
if day < 5:
try:
- dayWindows.append(win.derwin(int(maxy/5),maxx,int(day*(maxy/5))+1,1))
+ dayWindows.append(win.derwin(int(maxy/5),int(maxx/2),int(day*(maxy/5))+1,1))
except curses.error: pass
else:
try:
- dayWindows.append(win.derwin(int(maxy/5),maxx,int((day-5)*(maxy/5))+1,int(maxx/2)+1))
+ dayWindows.append(win.derwin(int(maxy/5),int(maxx/2),int((day-5)*(maxy/5))+1,int(maxx/2)+1))
except curses.error: pass
day += 1
day = 0
- while day < 5:
+ while day < 10:
scnDay(day)
day+=1
win.box()
diff -Naur CurseTheWeather-0.6-orig/weatherfeed.py CurseTheWeather-0.6/weatherfeed.py
--- CurseTheWeather-0.6-orig/weatherfeed.py 2009-07-14 08:17:40.000000000 -0400
+++ CurseTheWeather-0.6/weatherfeed.py 2014-11-22 17:26:07.789830359 -0500
@@ -48,11 +48,11 @@
def _getData(self):
"""Connect to weather.com and get the weather as raw XML"""
- urlHandle = urllib2.urlopen("http://xoap.weather.com/weather/local/%s?cc=1&dayf=5&prod=xoap&link=xoap&unit=%s&par=1003666583&key=4128909340a9b2fc" %(self.location, self.units))
+ urlHandle = urllib2.urlopen("http://xoap.weather.com/weather/local/%s?cc=1&dayf=10&prod=xoap&link=xoap&unit=%s&par=1003666583&key=4128909340a9b2fc" %(self.location, self.units))
return urlHandle.read()
def _getWeather(self):
- for node in self.dom.childNodes[3].childNodes:
+ for node in self.dom.childNodes[0].childNodes:
if node.nodeName == 'cc':
self._setCurrentConditions(node)
@@ -62,11 +62,17 @@
if node.nodeName == 'loc':
self._setCurrentConditions(node)
- if self.forecast[0]["day"]["type"] == "N/A":
+ # The current day may not have a forcast other than night
+ if "day" not in self.forecast[0] or self.forecast[0]["day"] == "N/A":
+ self.forecast[0]["day"] = {}
+ self.forecast[0]["day"]["wind"] = {}
self.forecast[0]["day"]["type"] = self.currentConditions["type"]
- if self.forecast[0]["day"]["wind"]["speed"] == "N/A" and self.forecast[0]["day"]["wind"]["direction"] == "N/A":
self.forecast[0]["day"]["wind"]["speed"] = self.currentConditions["wind"]["speed"]
+ self.forecast[0]["day"]["wind"]["gusts"] = self.currentConditions["wind"]["gusts"]
+ self.forecast[0]["day"]["wind"]["degrees"] = self.currentConditions["wind"]["degrees"]
self.forecast[0]["day"]["wind"]["direction"] = self.currentConditions["wind"]["direction"]
+ self.forecast[0]["day"]["humidity"] = self.currentConditions["humidity"]
+ self.forecast[0]["day"]["pop"] = "N/A"
def _setCurrentConditions(self, node):
for elem in node.childNodes:
@@ -183,7 +189,11 @@
self.forecast[index]["day"] = {}
for subelem in elem.childNodes:
if subelem.nodeName == 't':
- self.forecast[index]["day"]["type"] = subelem.firstChild.data
+ # type may be blank
+ if subelem.firstChild:
+ self.forecast[index]["day"]["type"] = subelem.firstChild.data
+ else:
+ self.forecast[index]["day"]["type"] = " "
if subelem.nodeName == 'ppcp':
self.forecast[index]["day"]["pop"] = subelem.firstChild.data
@@ -234,10 +244,6 @@
self.forecast[index]["night"]["wind"]["direction"] = windelem.firstChild.data
-
-
-
-
if elem.nodeName == 'wind':
self.forecast[index]["wind"] = {}
for subelem in elem.childNodes: