-
-
Save merbjedi/201249 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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