Sha256: 2c2df22c73eb7c3e60949cfafd0432019639cfdf1dd3bc27f544462abf54b987

Contents?: true

Size: 693 Bytes

Versions: 3

Compression:

Stored size: 693 Bytes

Contents

# encoding: utf-8
module Nokaya

  class Movie < Basic

    require 'spotlite'

    attr_reader :title, :ref_url, :year

    def initialize args, options = {}
      super(args, options)
      @type = :movie
      begin
        resp = Spotlite::Movie.find(@args.join(' '))
      rescue SocketError
        Logs.rec.error 'No connexion'
        return nil
      end
      @options['alt'] ? res = resp[1] : res = resp[0]
      @title = res.title
      @ref_url = res.url
      @year = res.year
      @urls = [res.poster_url]
      @filenames = name_files()
    end

    private

    def name_files
      @name ||= @workers.sanitize(@title)
      ["#{@type.to_s}-#{@name}.jpg"]
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nokaya-0.1.6 lib/nokaya/movie.rb
nokaya-0.1.5 lib/nokaya/movie.rb
nokaya-0.1.4 lib/nokaya/movie.rb