[Pkg-wmaker-commits] [wmforecast] 01/03: debian/patches/new_yahoo_api.patch: New patch; modifications to work with new Yahoo! weather API. Backported from upstream.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sun Apr 24 21:48:34 UTC 2016


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch debian/jessie
in repository wmforecast.

commit d7f9fee5a9da49800495b6b76bbcb62b179158ac
Author: Doug Torrance <dtorrance at piedmont.edu>
Date:   Sun Apr 24 17:07:50 2016 -0400

    debian/patches/new_yahoo_api.patch: New patch;
    modifications to work with new Yahoo! weather API.  Backported from
    upstream.
---
 debian/patches/new_yahoo_api.patch | 72 ++++++++++++++++++++++++++++++++++++++
 debian/patches/series              |  1 +
 2 files changed, 73 insertions(+)

diff --git a/debian/patches/new_yahoo_api.patch b/debian/patches/new_yahoo_api.patch
new file mode 100644
index 0000000..df8af3d
--- /dev/null
+++ b/debian/patches/new_yahoo_api.patch
@@ -0,0 +1,72 @@
+Description: Update to work with new Yahoo! weather API
+ Backported from upstream versions 0.10 and 0.11.
+Origin: https://github.com/d-torrance/wmforecast/commit/720f907
+Origin: https://github.com/d-torrance/wmforecast/commit/dcf081f
+Origin: https://github.com/d-torrance/wmforecast/commit/f19e666
+Last-Update: 2016-04-24
+
+--- a/wmforecast.c
++++ b/wmforecast.c
+@@ -296,7 +296,7 @@
+ 	text = wstrappend(text, ", ");
+ 	text = wstrappend(text, weather->temp);
+ 	text = wstrappend(text, "°\n\nForecast:\n");
+-	for (i = 0; i < weather->forecasts->length; i++) {
++	for (i = 0; i < weather->forecasts->length && i < 7; i++) {
+ 		text = wstrappend(text,weather->forecasts->forecasts[i].day);
+ 		text = wstrappend(text," - ");
+ 		text = wstrappend(text,weather->forecasts->forecasts[i].text);
+@@ -348,16 +348,23 @@
+ 	Weather *weather;
+ 	xmlDocPtr doc;
+ 	xmlNodePtr cur;
++	int i;
+ 
+-	url = wstrconcat("http://weather.yahooapis.com/forecastrss?u=",prefs->units);
++	url = wstrdup("https://query.yahooapis.com/v1/public/yql?q="
++		      "select%20*%20from%20weather.forecast%20where%20woeid");
+ 	if (strcmp(prefs->woeid_or_zip,"w") == 0) {
+-		url = wstrappend(url,"&w=");
++		url = wstrappend(url, "%20%3D%20");
+ 		url = wstrappend(url, prefs->woeid);
+ 	}
+ 	else {
+-		url = wstrappend(url,"&p=");
++		url = wstrappend(url, "%20in%20(select%20woeid%20from%20"
++				 "geo.places(1)%20where%20text%3D%22");
+ 		url = wstrappend(url, prefs->zip);
+-	}
++		url = wstrappend(url, "%22)");
++ 	}
++	url = wstrappend(url, "%20and%20u%3D'");
++	url = wstrappend(url, prefs->units);
++	url = wstrappend(url, "'&format=xml");
+ 
+ 	weather = newWeather();
+ 	chunk.memory = wmalloc(1);
+@@ -394,17 +401,16 @@
+ 		return weather;
+ 	}
+ 
+-	if (xmlStrcmp(cur->name, (const xmlChar *) "rss")) {
+-		setError(weather, screen,"Empty document");
+-		fprintf(stderr,"document of the wrong type, root node != rss");
+-		xmlFreeDoc(doc);
+-		return weather;
++	for (i = 0; i < 3; i++) {
++		cur = cur->children;
++		if (cur == NULL) {
++			setError(weather, screen,
++				 "Document not parsed successfully");
++			xmlFreeDoc(doc);
++			return weather;
++		}
+ 	}
+ 
+-	cur = cur->children;
+-	cur = cur->next;
+-	cur = cur->children;
+-
+ 	while (cur != NULL) {
+ 		if ((!xmlStrcmp(cur->name, (const xmlChar *)"item"))) {
+ 			cur = cur->children;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3d314c3
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+new_yahoo_api.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmforecast.git



More information about the Pkg-wmaker-commits mailing list