Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 19fda5af893b6b8039e327bf0d9c72a1cfa1aec5 @asacalow committed May 5, 2012
Showing with 738 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 flickr.yml.example
  3. +76 −0 swabdata.csv
  4. +47 −0 swabdata.rb
  5. +323 −0 swabdata.xml
  6. +289 −0 swabdata.xml.orig
@@ -0,0 +1 @@
+.DS_Store
@@ -0,0 +1,2 @@
+api_key: …
+shared_secret: …
@@ -0,0 +1,76 @@
+2,A,Stevenson Square EB,"53.48241, -2.23374",,,Time Table,33,3,http://www.flickr.com/photos/madlabuk/5738020960/in/set-72157626752827976/,,
+2,B,Stevenson Square EB,"53.48300, -2.23432 ",Into town,,Seat,62,5,http://www.flickr.com/photos/madlabuk/5738020116/in/set-72157626752827976/,,
+2,C,Stevenson Square East EB,"53.48286, -2.2336 ",Into town,,Time Table,7,3,http://www.flickr.com/photos/madlabuk/5738020278/in/set-72157626752827976/,,
+2,D,Stevenson Square East EB,"53.48286, -2.2336 ",Into town,,Seat,34,5,http://www.flickr.com/photos/madlabuk/5737468891/in/set-72157626752827976/,,
+2,E,Piccadilly Gardens M ,"53.48028, -2.23741",Into town,,Time Table,6,2,http://www.flickr.com/photos/madlabuk/5738021568/in/set-72157626752827976/,,
+2,F,Piccadilly Gardens H,"53.48064, -2.23819",Into town,,Time Table,39,4,http://www.flickr.com/photos/madlabuk/5737469607/in/set-72157626752827976/,,
+2,G,Piccadilly Gardens G,"53.48085, -2.23841",Into town,,Time Table,4,2,http://www.flickr.com/photos/madlabuk/5737469807/in/set-72157626752827976/,,
+3,A,EB0774,"53.4559,-2.2254",out of town,,Time Table,9,3,http://www.flickr.com/photos/madlabuk/5734642095/,,
+3,B,EB0776,"53.4536,-2.2232",out of town,,Time Table,3,1,http://www.flickr.com/photos/madlabuk/5735190702/,,
+3,C,EB0777 (Stop E),"53.45266,-2.22250",out of town,,Seat,100,2,http://www.flickr.com/photos/madlabuk/5734641179/,,
+3,D,EB0777 (Stop E),"53.45266,-2.22250",out of town,,Time Table,8,2,http://www.flickr.com/photos/madlabuk/5734641283/,,
+3,E,EB0778,"53.45069,-2.22139",out of town,,Seat,2,1,http://www.flickr.com/photos/madlabuk/5734641179/,,
+3,F,EB0778,"53.45069,-2.22139",out of town,,Time Table,31,5,http://www.flickr.com/photos/madlabuk/5735190260/,,
+3,G,EB0784 (Stop B),"53.44346,-2.21837",out of town,,Seat,17,2,http://www.flickr.com/photos/madlabuk/5735191028/,,
+3,H,EB0784 (Stop B),"53.44346,-2.21837",out of town,,Time Table,18,2,http://www.flickr.com/photos/madlabuk/5735191172/,,
+3,I,SB3394 (Stop F),"53.44077,-2.21920",out of town,,Seat,5,1,http://www.flickr.com/photos/madlabuk/5734641759/,,
+3,J,SB3394 (Stop F),"53.44077,-2.21920",out of town,,Time Table,30,2,http://www.flickr.com/photos/madlabuk/5734641623/,,
+4,A,Chetham's,"53.48583,-2.24476",out of town,,Time Table,1,1,http://www.flickr.com/photos/madlabuk/5734642405,,
+4,B,Cathedral,"53.48472,-2.24525",out of town,,Time Table,17,5,http://www.flickr.com/photos/madlabuk/5734638703/,,
+4,C,Harvey Nichol's,"53.48376,-2.24584",out of town,,Time Table,18,3,http://www.flickr.com/photos/madlabuk/5734642873/in/set-72157626752827976,,
+4,D,Barton Arcade,"53.48276,-2.24660",out of town,,Time Table,113,3,http://www.flickr.com/photos/madlabuk/5735191888,,
+4,E,Forsyth's,"53.48124,-2.24784",out of town,,Time Table,15,2,http://www.flickr.com/photos/madlabuk/5734638821/,,
+4,F,RBS,"53.48011,-2.24862",out of town,,Time Table,5,3,http://www.flickr.com/photos/madlabuk/5735188144/,,
+4,G,Sutton's City Living,"53.47788,-2.24968",out of town,,Time Table,9,3,http://www.flickr.com/photos/madlabuk/5735188388,,
+4,H,Evuna,"53.47646,-2.25066",out of town,,Time Table,127,4,http://www.flickr.com/photos/madlabuk/5734639067,,
+4,I,Santander,"53.47663,-2.25068",out of town,,Time Table,4,1,http://www.flickr.com/photos/madlabuk/5735188502/,,
+4,J,Centurion House,"53.47987,-2.24849",out of town,,Time Table,11,4,http://www.flickr.com/photos/madlabuk/5734639405,,
+5,A,Oldham Rd / New Cross,"53.48516,-2.23262",out of town,,,8,2,http://www.flickr.com/photos/madlabuk/5734640193/,,
+5,B,Oldham Rd / New Cross,"53.48516,-2.23262",out of town,,Seat,1,1,http://www.flickr.com/photos/madlabuk/5735189094/,,
+5,C,Oldham Rd / Thompson St,"53.48745,-2.23365",into town,,,14,4,http://www.flickr.com/photos/madlabuk/5734640327/,,
+5,D,Oldham Rd / Thompson St,"53.48745,-2.23365",into town,,,400,4,http://www.flickr.com/photos/madlabuk/5734640733/,,
+5,E,Oldham Rd / Butler St,"53.48872,-2.22249",into town,,,5,1,http://www.flickr.com/photos/madlabuk/5735188848/,,
+5,F,Oldham Rd / Butler St,"53.48872,-2.22249",into town,,,5,2,http://www.flickr.com/photos/madlabuk/5734639771/,,
+5,G,Oldham Rd / Naylor St,"53.48994,-2.22091",into town,,,14,4,http://www.flickr.com/photos/madlabuk/5734640473/,,
+5,H,Oldham Rd / Naylor St,"53.48994,-2.22091",into town,,,52,4,http://www.flickr.com/photos/madlabuk/5735189222/,,
+5,I,Oldham Rd / Grimshaw Ln,"53.49791,-2.2039",into town,,,3,3,http://www.flickr.com/photos/madlabuk/5735188740/,,
+5,J,Oldham Rd / Grimshaw Ln,"53.49791,-2.2039",into town,,,27,3,http://www.flickr.com/photos/madlabuk/5735189768/,,
+6,A,Picc Station (Stop 3),"53.4777, -2.2318",out of town,,Time Table,1,1,http://www.flickr.com/photos/madlabuk/5738022026/,,
+6,B,Piccadilly Station (Stop 3),"53.4777, -2.2318",out of town,,Seat,0,0,http://www.flickr.com/photos/madlabuk/5738021884/,,
+6,C,Outside Subway (Stop 1),"53.4783, -2.2320",out of town,,Time Table,3,2,http://www.flickr.com/photos/madlabuk/5737470515/,,
+6,D,Outside Subway (Stop 1),"53.4783, -2.2320",out of town,,Seat,1,1,http://www.flickr.com/photos/madlabuk/5737470635/,,
+6,E,Paton Street (Stop EQ),"53.4793, -2.2329",out of town,,Time Table,0,0,http://www.flickr.com/photos/madlabuk/5738022444/,,
+6,F,Paton Street (Stop EQ),"53.4793, -2.2329",out of town,,Seat,7,3,http://www.flickr.com/photos/madlabuk/5737470977/,,
+6,G,Paton Street (Stop EP),"53.4803, -2.2337",out of town,,Time Table,4,2,http://www.flickr.com/photos/madlabuk/5738022762/,,
+6,H,Paton Street (Stop EP),"53.4803, -2.2337",out of town,,Seat,0,0,http://www.flickr.com/photos/madlabuk/5737471175/,,
+6,I,Portland Street nr. Tesco (Stop EW),"53.4806, -2.2345",Into town,,Time Table,4,2,http://www.flickr.com/photos/madlabuk/5738023030/,,
+6,J,Portland Street nr. Tesco (Stop EW),"53.4806, -2.2345",Into town,,Seat,1,1,http://www.flickr.com/photos/madlabuk/5738023196/,,
+7,A,Newton Street,"53.48129,-2.23363",Out of town,,Time Table,3,2,http://www.flickr.com/photos/madlabuk/5736857349/in/set-72157626752827976,Off White,
+7,B,Newton Street,"53.48129,-2.23363",Out of town,,Bus Pole,6,1,http://www.flickr.com/photos/madlabuk/5737408158/in/set-72157626752827976,Off White,
+7,C,"Manchester City Centre, Portland Street/Chorlton St (Stop Cu)","53.47843,-2.23844",Out of town,,Bus Stop,22,3,http://www.flickr.com/photos/madlabuk/5737408488/in/set-72157626752827976,Bright Red,
+7,D,"Manchester City Centre, Portland Street/Chorlton St (Stop Cu)","53.47843,-2.23844",Out of town,,Time Table,58,4,http://www.flickr.com/photos/madlabuk/5737408660/in/set-72157626752827976,Bright Red,
+7,E,"Manchester City Centre, Portland Street/Sackville Street (SW-bound)‎","53.47832,-2.23858",Out of town,,Seat,118,3,http://www.flickr.com/photos/madlabuk/5736857785/in/set-72157626752827976,Yellow,
+7,F,"Manchester City Centre, Portland Street/Sackville Street (SW-bound)‎","53.47832,-2.23858",Out of town,,Time Table,12,2,http://www.flickr.com/photos/madlabuk/5737408918/in/set-72157626752827976,Bright Red,
+7,G,"Manchester City Centre, Chepstow St/Oxford St (Stop SV)‎","53.47957,-2.24312",Out of town,,Bus Stop,2,1,http://www.flickr.com/photos/madlabuk/5736858165/in/set-72157626752827976,Yellow,
+7,H,"Manchester City Centre, Chepstow St/Oxford St (Stop SV)‎","53.47957,-2.24312",Out of town,,Bus Pole,2,2,http://www.flickr.com/photos/madlabuk/5737409282/in/set-72157626752827976,Bright Red,
+7,I,"Piccadilly Gardens, Portland Street/Chorlton St (NE-bound)‎","53.47907,-2.23801",Into town,,Time Table,4,3,http://www.flickr.com/photos/madlabuk/5736858505/in/set-72157626752827976,Yellow,
+7,J,"Piccadilly Gardens, Portland Street/Chorlton St (NE-bound)‎","53.47907,-2.23801",Into town,,Bus Pole,8,2,http://www.flickr.com/photos/madlabuk/5736858671/in/set-72157626752827976,Bright Red,
+9,A,"Manchester City Centre, Corporation St","53.48550,-2.2420",Out of town,,Seat,6,1,http://www.flickr.com/photos/madlabuk/5737405384/in/set-72157626752827976/,Off white,
+9,B,"Manchester City Centre, Corporation St","53.48550,-2.2420",Out of town,,Timetable,10,2,http://www.flickr.com/photos/madlabuk/5737405562/in/set-72157626752827976,Off white,
+9,C,"Manchester City Centre, Corporation Street/Withy Gr","53.48566,-2.2415",Into town,,Seat,7,2,http://www.flickr.com/photos/madlabuk/5736855187/in/set-72157626752827976,Off white,
+9,D,"Manchester City Centre, Corporation Street/Withy Gr","53.48566,-2.2415",Into town,,Timetable,2,1,http://www.flickr.com/photos/madlabuk/5736855011/in/set-72157626752827976,Off white,
+9,E,"Newtown, Rochdale Road/Miller Street","53.48663,-2.2358",Out of town,,Seat,17,1,http://www.flickr.com/photos/madlabuk/5737405086/in/set-72157626752827976,Off white,
+9,F,"Newtown, Rochdale Road/Miller Street","53.48566,-2.2415",Out of town,,Timetable,23,3,http://www.flickr.com/photos/madlabuk/5736854061/in/set-72157626752827976,Off white,
+9,G,"Newtown, Rochdale Road/Thompson Street","53.48741,-2.2336",Into town,,Timetable,20,1,http://www.flickr.com/photos/madlabuk/5736855409/in/set-72157626752827976,Off white,
+9,H,"Newtown, opp Royal Mail Rochdale Road/Suddell Street‎","53.48825,-2.2321",Out of town,,Seat,5,1,http://www.flickr.com/photos/madlabuk/5736854771/in/set-72157626752827976,Off white,
+9,I,"Newtown, opp Royal Mail Rochdale Road/Suddell Street‎","53.48566,-2.2415",Out of town,,Timetable,12,1,http://www.flickr.com/photos/madlabuk/5737405722/in/set-72157626752827976,Off white,
+10,A,St Peters Square (Stop SZ),"53.4775, -2.2434",out of town,180,Seat,>500,5,http://www.flickr.com/photos/madlabuk/5735194900/in/set-72157626752827976,orange,
+10,B,St Peters Square (Stop SZ),"53.4775, -2.2434",out of town,180,Map,79,3,http://www.flickr.com/photos/madlabuk/5734645055/in/set-72157626752827976,off white,
+10,C,Mount Street (Stop SK),"53.4772, -2.2458",Into town,232,Map,14,1,"http://www.flickr.com/photos/madlabuk/5734643727/in/set-72157626752827976",off white,
+10,D,Mount Street (Stop SK),"53.4772, -2.2458",Into town,232,Seat,64,6,"http://www.flickr.com/photos/madlabuk/5735193750/in/set-72157626752827976",light orange,
+10,E,"Mount Street Central (Stop SG)","53.4783, -2.2455",Into town,114,Map,24,3,http://www.flickr.com/photos/madlabuk/5734644801/in/set-72157626752827976,black,
+10,F,Mount Street Central (Stop SG),"53.4783, -2.2455",Into town,114,Time Table,8,2,"http://www.flickr.com/photos/madlabuk/5734644481/in/set-72157626752827976",white,
+10,G,"Albert Square (Stop WD)","53.4794, -2.2458",Into town,109,Time Table,2,2,"http://www.flickr.com/photos/madlabuk/5735192874/in/set-72157626752827976",off white,
+10,H,Albert Square (Stop WD),"53.4794, -2.2458",Into town,109,Time Table,3,3,"http://www.flickr.com/photos/madlabuk/5735192614/in/set-72157626752827976",off white,
+10,I,"Princess Street, Town Hall (Stop SA)","53.4795, -2.2438",Into town,74,Map,46,5,"http://www.flickr.com/photos/madlabuk/5734640859/in/set-72157626752827976",white,
+10,J,"Princess Street, Town Hall (Stop SA)","53.4795, -2.2438",Into town,74,Seat,29,3,"http://www.flickr.com/photos/madlabuk/5734640951/in/set-72157626752827976",light yellow,
@@ -0,0 +1,47 @@
+require 'rubygems'
+require 'nokogiri'
+require 'csv'
+require 'flickraw'
+require 'yaml'
+
+creds = YAML.load_file('flickr.yml')
+
+FlickRaw.api_key = creds['api_key']
+FlickRaw.shared_secret = creds['shared_secret']
+
+doc = Nokogiri::XML "<?xml version=\"1.0\" encoding=\"UTF-8\"?><swabdata />"
+root = doc.root
+
+team_node = nil
+team_number = 0
+CSV.foreach("swabdata.csv") do |row|
+ tn, letter, name, longlat, dir, dist_th, loc, colonies, types, flickr_url, colour = row
+ puts "Processing '#{name.strip}'"
+ dir = (dir || '').downcase.include?('in') ? 'in' : 'out'
+ if (tn != team_number)
+ team_number = tn
+ team_node = Nokogiri::XML::Node.new 'team', doc
+ team_node['number'] = team_number
+ root << team_node
+ end
+ sample_node = Nokogiri::XML::Node.new 'sample', doc
+ team_node << sample_node
+ sample_node['letter'] = letter
+ sample_node['name'] = name.strip
+ sample_node['longlat'] = longlat
+ sample_node['dir'] = dir
+ sample_node['loc'] = loc || ''
+ sample_node['colonies'] = colonies
+ sample_node['types'] = types
+
+ img_node = Nokogiri::XML::Node.new 'imagepage', doc
+ img_node.content = flickr_url.strip
+ sample_node << img_node
+
+ thumb_node = Nokogiri::XML::Node.new 'thumb', doc
+ sample_node << thumb_node
+ id = flickr_url.strip[/^http:\/\/www.flickr.com\/photos\/madlabuk\/[0-9]*/, 0][(38..47)]
+ info = flickr.photos.getInfo(:photo_id => id)
+ thumb_node.content = FlickRaw.url_q(info)
+end
+File.open('swabdata.xml', 'w') {|f| f.write(doc.to_xml) }
Oops, something went wrong.

0 comments on commit 19fda5a

Please sign in to comment.