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
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> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD WIDTH = \"200\">Start: <BR/>End: </TD><TD> </TD><TD> </TD></TR>\n"
end
output << "</table></body>"
File.open("sessions.html", 'w') {|f| f.write(output) }
exec 'open sessions.html'
0 komentar:
Posting Komentar