class EZTV::Episode

Constants

SE_FORMAT
X_FORMAT

Attributes

episode_number[RW]
season[RW]

Public Class Methods

new(episode_node) click to toggle source
# File lib/eztv.rb, line 70
def initialize(episode_node)
  inner_text = episode_node.css('td.forum_thread_post a.epinfo').first.inner_text
  season_episode_match_data = inner_text.match(SE_FORMAT) || inner_text.match(X_FORMAT)

  @season = season_episode_match_data[1].to_i
  @episode_number = season_episode_match_data[2].to_i

  links_data = episode_node.css('td.forum_thread_post')[2]

  @magnet_link = links_data.css('a.magnet').first.attributes['href'].value

  @links = links_data.css('a')[2..-1].map do |a_element|
    a_element['href']
  end
end

Public Instance Methods

s01e01_format() click to toggle source
# File lib/eztv.rb, line 86
def s01e01_format
  @s01e01_format ||= "S" + season.to_s.rjust(2,'0') + "E" + episode_number.to_s.rjust(2,'0')
end