Skip to content

Instantly share code, notes, and snippets.

@merbjedi
Forked from jsmestad/tv_rage_spec.rb
Created October 4, 2009 08:18
Show Gist options
  • Save merbjedi/201249 to your computer and use it in GitHub Desktop.
Save merbjedi/201249 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'httparty'
class TvRage
include HTTParty
base_uri 'http://services.tvrage.com'
def self.full_schedule(country='US')
results = get("/feeds/fullschedule.php", :query => {"country" => country, '24_format'=> '1'})
results["schedule"]["DAY"].each do |day|
process_day(day["attr"], day["time"])
end
end
protected
# takes a day "YYYY-MM-DD" and a list of shows
def self.process_day(day, shows)
shows.each do |show|
process_show(show)
end
end
def self.process_show(show_data)
show = show_data["show"]
puts "\nProcessing show: #{show["name"]}"
puts show.inspect
rescue
puts "unable to process show:"
puts show_data.inspect
end
end
TvRage.full_schedule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment