Class: Videoinfo::Results::TvResult

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

Instance Attribute Summary collapse

Attributes inherited from Videoinfo::Result

#mediainfo, #screenshot_urls

Instance Method Summary collapse

Instance Attribute Details

#air_dateObject

Returns the value of attribute air_date.



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

def air_date
  @air_date
end

#countryObject

Returns the value of attribute country.



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

def country
  @country
end

#episode_imdb_idObject

Returns the value of attribute episode_imdb_id.



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

def episode_imdb_id
  @episode_imdb_id
end

#episode_numberObject

Returns the value of attribute episode_number.



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

def episode_number
  @episode_number
end

#episode_ratingObject

Returns the value of attribute episode_rating.



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

def episode_rating
  @episode_rating
end

#episode_titleObject

Returns the value of attribute episode_title.



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

def episode_title
  @episode_title
end

#episode_urlObject

Returns the value of attribute episode_url.



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

def episode_url
  @episode_url
end

#genresObject

Returns the value of attribute genres.



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

def genres
  @genres
end

#imdb_idObject

Returns the value of attribute imdb_id.



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

def imdb_id
  @imdb_id
end

#plotObject

Returns the value of attribute plot.



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

def plot
  @plot
end

#premieredObject

Returns the value of attribute premiered.



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

def premiered
  @premiered
end

#ratingObject

Returns the value of attribute rating.



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

def rating
  @rating
end

#season_numberObject

Returns the value of attribute season_number.



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

def season_number
  @season_number
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#episode_rating_over_tenObject



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

def episode_rating_over_ten
  episode_rating ? "#{episode_rating} / 10" : nil
end

#imdb_urlObject



15
16
17
# File 'lib/videoinfo/results/tv_result.rb', line 15

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/tv_result.rb', line 7

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

#to_sObject



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
44
45
46
# File 'lib/videoinfo/results/tv_result.rb', line 19

def to_s
  output = ['[b]Description:[/b]', '[quote]', plot, '[/quote]', '']
  output << '[b]Information:[/b]'
  output << '[quote]'
  output << "Show Name: #{title}"
  output << "Show url: #{imdb_url}"
  output << "Rating: #{rating_over_ten}"
  output << "Genres: #{(genres || []).join(' | ')}"
  output << "Country: #{country}"
  output << "Premiered: #{premiered}"                    if premiered
  output << "Season Number: #{season_number}"            if season_number
  output << "Episode Number: #{episode_number}"          if episode_number
  output << "Episode Name: #{episode_title}"             if episode_title
  output << "Episode url: #{episode_url}"                if episode_url
  output << "Episode Rating: #{episode_rating_over_ten}" if episode_rating_over_ten
  output << "Air Date: #{air_date}"                      if air_date
  output << '[/quote]'

  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