Class: ShowRobot::TVRage
Constant Summary
collapse
- DB_NAME =
'TVRage'
Instance Attribute Summary
Attributes inherited from Datasource
#mediaFile, #series
Instance Method Summary
collapse
Methods inherited from Datasource
#episode_list, #initialize, #series_list
Instance Method Details
#episode ⇒ Object
27
28
29
30
31
|
# 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 ⇒ Object
10
11
12
|
# 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 ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# 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
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 ⇒ Object
6
7
8
|
# 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 ⇒ Object
40
41
42
43
44
45
|
# File 'lib/showrobot/db/tvrage.rb', line 40
def show_id
if @showId.nil?
fetch
end
@showId
end
|
#show_name ⇒ Object
33
34
35
36
37
38
|
# File 'lib/showrobot/db/tvrage.rb', line 33
def show_name
if @showName.nil?
fetch
end
@showName
end
|