Wednesday, May 27, 2009

WWDC Session Times

Okay, the session times have not been officially released for WWDC, but the underlying data used for the sessions website contains time and room data. Of course, since this hasn't been released, it's completely unofficial and likely to change, but for those who have been asking for WWDC session times, I give you... not the session times, but a script that will fetch the latest data and format it into a HTML table for you.

It's a ruby script, so it should run on any stock OS X machine. This is public domain code, do with it what you will. If you improve it, I'd love a copy of your version.

#!/usr/bin/env ruby
#
# This program will download the latest session JSON data
# from the WWDC website and will parse it into a plain
# HTML table so it can be viewed.
#
# Sorry about the cheezy HTML formatting; I am not a designer.
# If you'd like to contribute a better looking design, I'll
# incorporate it.
#
# Requires one of the following two gems to be installed:
#
# gem install json
# gem install json_pure
require 'rubygems'
require 'net/http'
require 'open-uri'
require 'json'


output = ""
output << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n\"http://www.w3.org/TR/html4/loose.dtd\">\n<HTML><head>\n\t<title>WWDC Session Times</title>\n</HEAD><body>"
output << "<TABLE WIDTH=\"100%\" BORDER=\"1\"><TR><TH>ID</TH><TH>Title</TH><TH>Focus</TH><TH>Level</th><TH>Type</TH><TH>Time</TH><TH>Room</TH><TH>Description</TR>\n"

r = open("http://developer.apple.com/wwdc/data/sessions.json").read

parsed = JSON.parse r
data = parsed["SessionsData"]

data.each do | oneSession |


lowerTime = oneSession["time"][0]["lower"]
upperTime = oneSession["time"][0]["upper"]


output << "<TR>"
output << "<TD>#{oneSession["id"]}</TD><TD>#{oneSession["title"].to_s}</TD><TD>#{oneSession["focus"].to_s}</TD><TD>#{oneSession["level"].to_s}</TD><TD>#{oneSession["type"].to_s}</TD><TD WIDTH = \"200\">Start: #{lowerTime.to_s} <BR/>End: #{upperTime.to_s}</TD><TD>#{oneSession["room"].to_s}</TD><TD>#{oneSession["description"].to_s}</TD></TR>\n"

end

output << "</table></body>"
File.open("sessions.html", 'w') {|f| f.write(output) }
exec 'open sessions.html'




10 comments:

Patrick said...

You need a :

require 'rubygems'

for the json gem to be used.

Thanks for the script.

Jeff LaMarche said...

I'll fix - thanks, I manually installed mine, guess that's why it worked. :)

Quazie said...

I had to flip the json and rubygems lines to get it to work.

Excellent post though.

Brian Hardy said...

Great stuff, as usual, Jeff. I posted a version that creates iCalendar output on the Big Nerd Ranch blog.

StuFFmc (.com) said...

Great! Jeff, I *really* want to meet you @ wwdc. Any reason why you guys provide the code instead of the "result"? Brian great variation!

Jeff LaMarche said...

StuFFmc

The content is going to rapidly change - if I provide the content, then I become responsible for keeping it updated. If I provide the script to pull the information down, I can wash my hands of it.

Give a man a fish...

Jeff

Jeff LaMarche said...

Brian:

Ah, man.. I wish I had seen your comment before I wrote my own iCal version.

Jeff

Edwin said...

scrub m65 kamagra attorney lawyer body scrub field jacket lovegra marijuana attorney injury lawyer

JeansPilot said...

JeansPilot offers the chance to buy a large variety of men’s and women’s jeans clothing from the world famous Italian Brands.
Online jeans clothing store looks for original fashion clothing sales and clearances of worldwide known designers. We participate in fashion auctions to get the lowest possible price for Top quality Clothes, Shoes and Accessories.
Buy Jeans

h4ns said...

What youre saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I also love the images you put in here. They fit so well with what youre trying to say. Im sure youll reach so many people with what youve got to say.

Arsenal vs Huddersfield Town live streaming
Arsenal vs Huddersfield Town live streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Notts County vs Manchester City Live Streaming
Notts County vs Manchester City Live Streaming
Bologna vs AS Roma Live Streaming
Bologna vs AS Roma Live Streaming
Juventus vs Udinese Live Streaming
Juventus vs Udinese Live Streaming
Napoli vs Sampdoria Live Streaming
Napoli vs Sampdoria Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
AS Monaco vs Marseille Live Streaming
AS Monaco vs Marseille Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Technology News | News Today | Live Streaming TV Channels