Class: Newzleech::NZB

Inherits:
Object
  • Object
show all
Defined in:
lib/sites/newzleech/nzb.rb

Constant Summary collapse

URL =
'http://www.newzleech.com'
DAYS_BY_PAGE =
1.7

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ NZB

Returns a new instance of NZB.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sites/newzleech/nzb.rb', line 15

def initialize(options = {})
  @options = options
  @options[:age] ||= 160
  @options[:pages] ||= ((@options[:age].to_f + DAYS_BY_PAGE) / DAYS_BY_PAGE).ceil

  @nzb_urls = []
  @nzbs = []

  (1..(@options[:pages].to_i)).each do |page|
    @nzb_urls << "#{URL}?group=143&minage=&age=160&min=4000&max=max&q=&m=search&adv=1&offset=#{(page.to_i - 1) * 60}"
  end

  parse_newzleech
end

Instance Attribute Details

#nzbsObject

Returns the value of attribute nzbs.



13
14
15
# File 'lib/sites/newzleech/nzb.rb', line 13

def nzbs
  @nzbs
end

Instance Method Details

#download(movie) ⇒ Object



30
31
32
# File 'lib/sites/newzleech/nzb.rb', line 30

def download(movie)
  open(movie.nzb_link).read
end