From bbe61e5f2eee45b477ba6fae221e5a08f8e7c85a Mon Sep 17 00:00:00 2001 From: Phillip Warner Date: Mon, 11 Nov 2013 10:34:20 -0600 Subject: desktop/CurseTheWeather: Fixed for weather feed changes Signed-off-by: Robby Workman --- desktop/CurseTheWeather/CurseTheWeather-0.6-patch | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 desktop/CurseTheWeather/CurseTheWeather-0.6-patch (limited to 'desktop/CurseTheWeather/CurseTheWeather-0.6-patch') diff --git a/desktop/CurseTheWeather/CurseTheWeather-0.6-patch b/desktop/CurseTheWeather/CurseTheWeather-0.6-patch new file mode 100644 index 000000000000..a2166a8ff98b --- /dev/null +++ b/desktop/CurseTheWeather/CurseTheWeather-0.6-patch @@ -0,0 +1,75 @@ +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 2013-11-08 18:46:54.747612989 -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 2013-11-08 18:54:08.193597004 -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: +@@ -234,10 +240,6 @@ + self.forecast[index]["night"]["wind"]["direction"] = windelem.firstChild.data + + +- +- +- +- + if elem.nodeName == 'wind': + self.forecast[index]["wind"] = {} + for subelem in elem.childNodes: -- cgit v1.2.3