Class: Videoinfo::Results::MovieResult

Inherits:
Videoinfo::Result show all
Defined in:
lib/videoinfo/results/movie_result.rb

Instance Attribute Summary collapse

Attributes inherited from Videoinfo::Result

#mediainfo, #screenshot_urls

Instance Method Summary collapse

Instance Attribute Details

#directorObject

Returns the value of attribute director.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def director
  @director
end

#genresObject

Returns the value of attribute genres.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def genres
  @genres
end

#imdb_idObject

Returns the value of attribute imdb_id.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def imdb_id
  @imdb_id
end

#plot_summaryObject

Returns the value of attribute plot_summary.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def plot_summary
  @plot_summary
end

#ratingObject

Returns the value of attribute rating.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def rating
  @rating
end

#release_dateObject

Returns the value of attribute release_date.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def release_date
  @release_date
end

#runtimeObject

Returns the value of attribute runtime.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def runtime
  @runtime
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def title
  @title
end

#trailer_urlObject

Returns the value of attribute trailer_url.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def trailer_url
  @trailer_url
end

#wiki_urlObject

Returns the value of attribute wiki_url.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def wiki_url
  @wiki_url
end

#writersObject

Returns the value of attribute writers.



5
6
7
# File 'lib/videoinfo/results/movie_result.rb', line 5

def writers
  @writers
end

Instance Method Details

#imdb_urlObject



11
12
13
# File 'lib/videoinfo/results/movie_result.rb', line 11

def imdb_url
  imdb_id ? "http://www.imdb.com/title/tt#{imdb_id}" : nil
end

#rating_over_tenObject



7
8
9
# File 'lib/videoinfo/results/movie_result.rb', line 7

def rating_over_ten
  rating ? "#{rating} / 10" : nil
end

#to_sObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/videoinfo/results/movie_result.rb', line 15

def to_s
  output = ['[b]Description:[/b]', '[quote]', plot_summary, '[/quote]', '']
  output << '[b]Information:[/b]'
  output << '[quote]'
  output << "Title: #{title}"
  output << "Rating: #{rating_over_ten}"
  output << "Release Date: #{release_date}"
  output << "Genres: #{(genres || []).join(' | ')}"
  output << "Director: #{director}"          if director
  output << "Writers: #{writers.join(', ')}" if writers && writers.size > 0
  output << "Runtime: #{runtime} minutes"    if runtime
  output << "Wikipedia url: #{wiki_url}"     if wiki_url
  output << "IDMB url: #{imdb_url}"
  output << '[/quote]'

  if trailer_url
    output += ['', '[b]Trailer:[/b]', '[quote]', "[center][youtube]#{trailer_url}[/youtube][/center]", '[/quote]']
  end

  if screenshot_urls && screenshot_urls.size > 0
    output += ['', '[b]Screenshots:[/b]', '[quote][align=center]']
    output += screenshot_urls.map { |url| "[img=#{url}]" }
    output += ['[/align][/quote]']
  end

  output += ['', '[mediainfo]', mediainfo, '[/mediainfo]']

  output.join("\n")
end