lib/tmdb/tmdb_image.rb in royw-tmdb-0.1.3 vs lib/tmdb/tmdb_image.rb in royw-tmdb-0.1.4
- old
+ new
@@ -98,22 +98,26 @@
unless profile.nil? || profile.movie.blank?
movie = profile.movie
unless movie[type].blank?
images = movie[type]
images.each do |image|
- if image['size'] == size
+ image_size = image['size']
+ image_size = image_size.first if image_size.respond_to?('first')
+ if image_size == size
@logger.debug { "#{image.inspect}" }
src_url = image['content']
end
+ break unless src_url.blank?
end
end
end
src_url
end
# download the fanart
# returns nil if no attempt to copy was made, 0 on error, or the image size in bytes on success
def copy_image(src_url, dest_filespec)
+ @logger.debug { "copy_image(#{src_url}, #{dest_filespec})" }
image_size = nil
unless src_url.blank? || dest_filespec.blank?
begin
image_size = 0
extension = File.extname(src_url)