Sha256: 1e0a6648555eaf114580ef3ca261919f262728b5c2897c9bdcb104eadf43489f

Contents?: true

Size: 571 Bytes

Versions: 8

Compression:

Stored size: 571 Bytes

Contents

require 'open-uri'

class NFO
  
  attr_accessor :srt, :imdb_link
  
  def initialize(url)
    @nfo = open(url.gsub(/\/$/,'')).read
    @srt = []
    
    parse_nfo
    @srt.uniq!
  end
  
private

  def parse_nfo
    @nfo.split(/\n/).each do |line|
      case line
      when /subtitle|sub/i
        @srt << 'fr' if line =~ /fr|fre|french/i
        @srt << 'en' if line =~ /en|eng|english/i
      when /imdb\.com\/title\//
        @imdb_link = (matched = line.match(/imdb.com\/title\/(tt[0-9]+)/)) && "http://imdb.com/title/#{matched[1]}"
      end
    end
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pirate-autonzb-0.2.3 lib/nfo.rb
pirate-autonzb-0.2.4 lib/nfo.rb
pirate-autonzb-0.3.2 lib/nfo.rb
pirate-autonzb-0.3.3 lib/nfo.rb
pirate-autonzb-0.3.4 lib/nfo.rb
pirate-autonzb-0.3.5 lib/nfo.rb
pirate-autonzb-0.3 lib/nfo.rb
pirate-autonzb-0.4 lib/nfo.rb