Add weekend Network 10
[bus.git] / maxious-canberra-transit-feed / 01-extracttimes.rb
blob:a/maxious-canberra-transit-feed/01-extracttimes.rb -> blob:b/maxious-canberra-transit-feed/01-extracttimes.rb
--- a/maxious-canberra-transit-feed/01-extracttimes.rb
+++ b/maxious-canberra-transit-feed/01-extracttimes.rb
@@ -14,10 +14,15 @@
 	timetable = {"between_stops" => [], "short_name" => short_name}
 	time_points = table.xpath('tr[1]//th').map do |tp|
 		if tp.content != "\302\240" && tp.content != "" && tp.content != "<br/>"
-			timing_point = tp.content.squeeze(" ").gsub("Bus Station"," Bus Station ").gsub(" Platform"," (Platform").gsub("  - "," - ").gsub("\n"," ").gsub("\r"," ").gsub("\t"," ").gsub("\\"," / ").gsub("/"," / ").gsub(","," ").gsub("\302\240","").squeeze(" ").strip
+			timing_point = tp.content.squeeze(" ").gsub("Shops"," ").gsub("Bus Station"," Bus Station ").gsub("Interchange"," Bus Station ").gsub(" Platform"," (Platform")
+			timing_point = timing_point.gsub("Machonochie","Maconochie").gsub("Hume"," ").gsub("Market Place","Marketplace").gsub("Terminus Fyshwick","Terminus")
+			timing_point = timing_point.gsub("  - "," - ").gsub("\n"," ").gsub("\r"," ").gsub("\t"," ").gsub("\\"," / ").gsub("/"," / ").gsub(","," ").gsub("\302\240","").squeeze(" ").strip
+			if (short_name == "923" or short_name == "924" or short_name == "938") and timing_point == "Pearce"
+			  timing_point = "Canberra Hospital"
+			end
 			if (tp.content.match('Platform'))
 			  timing_point.concat(")")
-			end;
+			end
 			if tp.to_s.match(/[0-9][0-9][0-9]/) or tp.to_s.include? "Wheelchair"
 			  timing_point = nil
 			end
@@ -79,7 +84,9 @@
 		timetables << makeTimetable(table, "stop_times", short_name)
 	end
 	doc.xpath('//table[preceding::text()="This timetable is effective from Monday 15th November 2010."]').each do |table|
-		timetables << makeTimetable(table, "stop_times", short_name)
+		if short_name[0].chr != "9" or short_name.size == 1
+		  timetables << makeTimetable(table, "stop_times", short_name)
+		end
 	end
 	#all tables are weekdays on some really malformatted timetables
 	if short_name == "170"