desktop/CurseTheWeather: Fixed for weather feed changes

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
Phillip Warner 2013-11-11 10:34:20 -06:00 committed by Robby Workman
parent 73d3cf9a7b
commit bbe61e5f2e
3 changed files with 81 additions and 5 deletions

View file

@ -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:

View file

@ -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

View file

@ -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