summaryrefslogtreecommitdiff
path: root/desktop/CurseTheWeather/CurseTheWeather-0.6-patch
blob: a2166a8ff98be567318cfcb208a0c0914fe53624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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: