diff options
author | Phillip Warner <pc_warner@yahoo.com> | 2013-11-11 10:34:20 -0600 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2013-11-11 10:53:38 -0600 |
commit | bbe61e5f2eee45b477ba6fae221e5a08f8e7c85a (patch) | |
tree | 784ee92fac507b5337ed62bf309bb922b24302c0 | |
parent | 73d3cf9a7b1bf805355bd76bcb42f44748a8e325 (diff) |
desktop/CurseTheWeather: Fixed for weather feed changes
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
-rw-r--r-- | desktop/CurseTheWeather/CurseTheWeather-0.6-patch | 75 | ||||
-rw-r--r-- | desktop/CurseTheWeather/CurseTheWeather.SlackBuild | 6 | ||||
-rw-r--r-- | desktop/CurseTheWeather/README | 5 |
3 files changed, 81 insertions, 5 deletions
diff --git a/desktop/CurseTheWeather/CurseTheWeather-0.6-patch b/desktop/CurseTheWeather/CurseTheWeather-0.6-patch new file mode 100644 index 0000000000000..a2166a8ff98be --- /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: diff --git a/desktop/CurseTheWeather/CurseTheWeather.SlackBuild b/desktop/CurseTheWeather/CurseTheWeather.SlackBuild index 1817a6b78c5b6..97cd3b5d3bfab 100644 --- a/desktop/CurseTheWeather/CurseTheWeather.SlackBuild +++ b/desktop/CurseTheWeather/CurseTheWeather.SlackBuild @@ -26,7 +26,7 @@ PRGNAM=CurseTheWeather VERSION=0.6 -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} # Automatically determine the architecture we're building on: @@ -55,6 +55,10 @@ cd $PRGNAM-$VERSION chown -R root:root . chmod -R u+w,go+r-w,a-s . +# Patch ctw to work with latest weather feed changes +# and display 10 day forecast +patch -p1 < $CWD/$PRGNAM-$VERSION-patch + python setup.py install --prefix $PKG/usr mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION diff --git a/desktop/CurseTheWeather/README b/desktop/CurseTheWeather/README index 65f6254240f68..7f62a8bea7373 100644 --- a/desktop/CurseTheWeather/README +++ b/desktop/CurseTheWeather/README @@ -1,13 +1,10 @@ CurseTheWeather is a python application which displays the weather in a terminal via a ncurses frontend (ctw). This frontend shows ascii-art weather -icons along with the current weather conditions and 5 day forecast. +icons along with the current weather conditions and 10 day forecast. weatherfeed.py is the python module that grabs the weather data from weather.com, and it can used by frontends other than ctw. -** Please note ** CTW does not currently display a full 10 day forecast -due to changes with weather.com. - ** ctw and Transparency, Different Colors ** To modify transparency and color behavior in ctw simply modify |