parse.lua: Update for gsoc12.csv, and *hack* the code to work with the new format

Sat, 31 Mar 2012 22:13:32 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 31 Mar 2012 22:13:32 +0100
changeset 2
5c9d6eba65bc
parent 1
102ae45e5b96
child 3
5b24d66365ec

parse.lua: Update for gsoc12.csv, and *hack* the code to work with the new format

parse.lua file | annotate | diff | comparison | revisions
--- a/parse.lua	Sat Mar 31 22:10:15 2012 +0100
+++ b/parse.lua	Sat Mar 31 22:13:32 2012 +0100
@@ -2,10 +2,14 @@
 local have_https, https = pcall(require,"https");
 local csv = require "csv"
 
-for line in io.lines("gsoc10.csv") do
+for line in io.lines(arg[1] or "gsoc12.csv") do
 	local project = {};
 	csv.read_record(line, function (v) project[#project+1] = v; end);
-	local url = project[5]:match("https?://[^\"]+");
+	-- FIXME: The original code doesn't work this year,
+	-- I think csv.lua doesn't handle quoted values
+	-- (ie. the 'Tags' column) properly.
+	--local url = project[5]:match("https?://[^\"]+");
+	local url = line:match(",([^,]+)$");
 	if url and url:match("^http"..(have_https and "s?" or "")..":") then
 		local data, err = http.request(url);
 		if not data then

mercurial