class DownloadTV::Addic7ed

Addic7ed prototype (WIP)

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/download_tv/grabbers/addic7ed.rb, line 7
def initialize
  super('http://www.addic7ed.com/search.php?search=%s'\
        '&Submit=Search')
end

Public Instance Methods

download_file(url) click to toggle source
# File lib/download_tv/grabbers/addic7ed.rb, line 41
def download_file(url)
  # Url must be like 'http://www.addic7ed.com/updated/1/115337/0'

  # ADDIC7ED PROVIDES RSS

  agent = Mechanize.new
  page = agent.get(url, [], @url)
  puts page.save('Hi')
end
get_subs(show) click to toggle source
# File lib/download_tv/grabbers/addic7ed.rb, line 12
def get_subs(show)
  url = get_url(show)
  download_file(url)
end
get_url(show) click to toggle source
# File lib/download_tv/grabbers/addic7ed.rb, line 17
def get_url(show)
  # Change spaces for the separator
  s = show.gsub(' ', @sep)

  # Format the url
  search = Format(@url, s)

  agent = Mechanize.new
  res = agent.get(search)

  # No redirection means no subtitle found
  raise NoSubtitlesError if res.uri.to_s == search

  ##########
  # DO OPENSUBTITLES FIRST (see subtitles.rb)
  #####

  # We now have an URL like:
  # http://www.addic7ed.com/serie/Mr._Robot/2/3/eps2.1k3rnel-pan1c.ksd

  # To find the real links:
  # see comments at the end of file
end