class ShowRobot::TVRage

Constants

DB_NAME

Public Instance Methods

episode() click to toggle source
# File lib/showrobot/db/tvrage.rb, line 27
def episode
        puts "  Fetching episode list for #{show_name}@#{show_id} (#{episode_query})" if ShowRobot::VERBOSE

        puts fetch(:xml, episode_query).find("//episode[seasonnum/.=#{@mediaFile.season} and epnum/.=#{@mediaFile.episode}]")
end
episode_query() click to toggle source
# File lib/showrobot/db/tvrage.rb, line 10
def episode_query
        "http://services.tvrage.com/feeds/full_show_info.php?sid=#{show_id}"
end
fetch() click to toggle source
# File lib/showrobot/db/tvrage.rb, line 14
def fetch
        puts "  Fetching #{@mediaFile.name_guess} from #{DB_NAME} (#{match_query})" if ShowRobot::VERBOSE

        doc = XML::Parser.string(open(match_query).read).parse

        # TODO - make sure this matches
        bestMatch = doc.find('//show').first
        @showName = bestMatch.find('name').first.content
        @showId = bestMatch.find('showid').first.content

        puts "    --> Query: [ #{@mediaFile.name_guess} ] Match: [ #{@showName} ]@#{@showId}" if ShowRobot::VERBOSE
end
match_query() click to toggle source
# File lib/showrobot/db/tvrage.rb, line 6
def match_query
        "http://services.tvrage.com/feeds/full_search.php?show=#{ShowRobot.url_encode @mediaFile.name_guess}"
end
show_id() click to toggle source
# File lib/showrobot/db/tvrage.rb, line 40
def show_id
        if @showId.nil?
                fetch
        end
        @showId
end
show_name() click to toggle source
# File lib/showrobot/db/tvrage.rb, line 33
def show_name
        if @showName.nil?
                fetch
        end
        @showName
end