Class: ThumbnailController

Inherits:
Object
  • Object
show all
Defined in:
lib/dvdprofiler2xbmc/controllers/thumbnail_controller.rb

Overview

Synopsis

Used to fetch thumbnail images from

Usage:

controller = ThumbnailController.new(media)
controller.update

or

ThumbnailController.update(media)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(media) ⇒ ThumbnailController

Returns a new instance of ThumbnailController



15
16
17
# File 'lib/dvdprofiler2xbmc/controllers/thumbnail_controller.rb', line 15

def initialize(media)
  @media = media
end

Class Method Details

.update(media) ⇒ Object



11
12
13
# File 'lib/dvdprofiler2xbmc/controllers/thumbnail_controller.rb', line 11

def self.update(media)
  ThumbnailController.new(media).update
end

Instance Method Details

#updateObject

update the movie's thumbnail (.tbn) image



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dvdprofiler2xbmc/controllers/thumbnail_controller.rb', line 20

def update
  result = false
  if @media.isbn.blank?
    unless @media.imdb_id.blank?
      if @media.image_files.empty?
        fetch_imdb_thumbnail(@media.imdb_id)
        result = true
      end
    end
  else
    copy_thumbnail(@media.isbn)
    result = true
  end
  result
end