Class: TVSubtitle

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

Overview

Instance Method Summary collapse

Constructor Details

#initialize(inspector) ⇒ TVSubtitle

Returns a new instance of TVSubtitle.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sites/tvsubtitle.rb', line 10

def initialize(inspector)
  @inspector = inspector
  episodes = @inspector.episodes.select { |e| e.need_srt?(@inspector.langs) }
  
  $stdout.print "--------------------------------------------\n"
  $stdout.print "Searching for srt in www.tvsubtitles.net RSS\n"
  $stdout.print "--------------------------------------------\n"
  @inspector.langs.each do |l|
    rss(l).items.each do |item|
      episodes.each do |e|
        unless e.srt.include?(l)
          if episode_title(e, l) == item_title(item)
            download_srt(item, e, l)
            inspector.log.info "#{e.episode_name_with_format} [#{l}] // TVSubtitle // #{@srt_name}"
            $stdout.print "FOUND: #{e.episode_name_with_format} [#{l}]\n"
            e.srt << l
            @inspector.growl_episode(e, l)
          end
        end
      end
    end
  end
end