Module: TivoHMO::API::Metadata
- Extended by:
- ActiveSupport::Concern
- Includes:
- GemLogger::LoggerSupport
- Included in:
- TivoHMO::Adapters::Plex::Metadata, TivoHMO::Adapters::Settings::Metadata, TivoHMO::Adapters::StreamIO::Metadata
- Defined in:
- lib/tivohmo/api/metadata.rb
Overview
Metadata abstraction for containing and displaying supplemental info about an Item
Constant Summary collapse
- MPAA_RATINGS =
{ 'G' => 1, 'PG' => 2, 'PG-13' => 3, 'PG13' => 3, 'R' => 4, 'X' => 5, 'NC-17' => 6, 'NC17' => 6, 'NR' => 8, 'UNRATED' => 8, 'G1' => 1, 'P2' => 2, 'P3' => 3, 'R4' => 4, 'X5' => 5, 'N6' => 6, 'N8' => 8 }
- TV_RATINGS =
{ 'TV-Y7' => 1, 'TV-Y' => 2, 'TV-G' => 3, 'TV-PG' => 4, 'TV-14' => 5, 'TV-MA' => 6, 'TV-NR' => 7, 'TVY7' => 1, 'TVY' => 2, 'TVG' => 3, 'TVPG' => 4, 'TV14' => 5, 'TVMA' => 6, 'TVNR' => 7, 'Y7' => 1, 'Y' => 2, 'G' => 3, 'PG' => 4, '14' => 5, 'MA' => 6, 'NR' => 7, 'UNRATED' => 7, 'X1' => 1, 'X2' => 2, 'X3' => 3, 'X4' => 4, 'X5' => 5, 'X6' => 6, 'X7' => 7 }
Instance Attribute Summary collapse
-
#actors ⇒ Object
Returns the value of attribute actors.
-
#actual_showing ⇒ Object
Returns the value of attribute actual_showing.
-
#advisory ⇒ Object
Returns the value of attribute advisory.
-
#bookmark ⇒ Object
Returns the value of attribute bookmark.
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#choreographers ⇒ Object
Returns the value of attribute choreographers.
-
#color_code ⇒ Object
Returns the value of attribute color_code.
-
#description ⇒ Object
Returns the value of attribute description.
-
#directors ⇒ Object
Returns the value of attribute directors.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#episode_number ⇒ Object
Returns the value of attribute episode_number.
-
#episode_title ⇒ Object
Returns the value of attribute episode_title.
-
#executive_producers ⇒ Object
Returns the value of attribute executive_producers.
-
#guest_stars ⇒ Object
Returns the value of attribute guest_stars.
-
#hosts ⇒ Object
Returns the value of attribute hosts.
-
#is_episode ⇒ Object
Returns the value of attribute is_episode.
-
#item ⇒ Object
Returns the value of attribute item.
-
#movie_year ⇒ Object
Returns the value of attribute movie_year.
-
#mpaa_rating ⇒ Object
Returns the value of attribute mpaa_rating.
-
#original_air_date ⇒ Object
Returns the value of attribute original_air_date.
-
#part_count ⇒ Object
Returns the value of attribute part_count.
-
#part_index ⇒ Object
Returns the value of attribute part_index.
-
#producers ⇒ Object
Returns the value of attribute producers.
-
#program_genres ⇒ Object
Returns the value of attribute program_genres.
-
#program_id ⇒ Object
Returns the value of attribute program_id.
-
#recording_quality ⇒ Object
Returns the value of attribute recording_quality.
-
#series_genres ⇒ Object
Returns the value of attribute series_genres.
-
#series_id ⇒ Object
Returns the value of attribute series_id.
-
#series_title ⇒ Object
Returns the value of attribute series_title.
-
#show_type ⇒ Object
Returns the value of attribute show_type.
-
#showing_bits ⇒ Object
Returns the value of attribute showing_bits.
-
#source_size ⇒ Object
Returns the value of attribute source_size.
-
#star_rating ⇒ Object
Returns the value of attribute star_rating.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#stop_time ⇒ Object
Returns the value of attribute stop_time.
-
#time ⇒ Object
Returns the value of attribute time.
-
#title ⇒ Object
Returns the value of attribute title.
-
#tv_rating ⇒ Object
Returns the value of attribute tv_rating.
-
#writers ⇒ Object
Returns the value of attribute writers.
Instance Method Summary collapse
Instance Attribute Details
#actors ⇒ Object
Returns the value of attribute actors.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def actors @actors end |
#actual_showing ⇒ Object
Returns the value of attribute actual_showing.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def actual_showing @actual_showing end |
#advisory ⇒ Object
Returns the value of attribute advisory.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def advisory @advisory end |
#bookmark ⇒ Object
Returns the value of attribute bookmark.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def bookmark @bookmark end |
#channel ⇒ Object
Returns the value of attribute channel.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def channel @channel end |
#choreographers ⇒ Object
Returns the value of attribute choreographers.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def choreographers @choreographers end |
#color_code ⇒ Object
Returns the value of attribute color_code.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def color_code @color_code end |
#description ⇒ Object
Returns the value of attribute description.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def description @description end |
#directors ⇒ Object
Returns the value of attribute directors.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def directors @directors end |
#duration ⇒ Object
Returns the value of attribute duration.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def duration @duration end |
#episode_number ⇒ Object
Returns the value of attribute episode_number.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def episode_number @episode_number end |
#episode_title ⇒ Object
Returns the value of attribute episode_title.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def episode_title @episode_title end |
#executive_producers ⇒ Object
Returns the value of attribute executive_producers.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def executive_producers @executive_producers end |
#guest_stars ⇒ Object
Returns the value of attribute guest_stars.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def guest_stars @guest_stars end |
#hosts ⇒ Object
Returns the value of attribute hosts.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def hosts @hosts end |
#is_episode ⇒ Object
Returns the value of attribute is_episode.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def is_episode @is_episode end |
#item ⇒ Object
Returns the value of attribute item.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def item @item end |
#movie_year ⇒ Object
Returns the value of attribute movie_year.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def movie_year @movie_year end |
#mpaa_rating ⇒ Object
Returns the value of attribute mpaa_rating.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def @mpaa_rating end |
#original_air_date ⇒ Object
Returns the value of attribute original_air_date.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def original_air_date @original_air_date end |
#part_count ⇒ Object
Returns the value of attribute part_count.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def part_count @part_count end |
#part_index ⇒ Object
Returns the value of attribute part_index.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def part_index @part_index end |
#producers ⇒ Object
Returns the value of attribute producers.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def producers @producers end |
#program_genres ⇒ Object
Returns the value of attribute program_genres.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def program_genres @program_genres end |
#program_id ⇒ Object
Returns the value of attribute program_id.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def program_id @program_id end |
#recording_quality ⇒ Object
Returns the value of attribute recording_quality.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def recording_quality @recording_quality end |
#series_genres ⇒ Object
Returns the value of attribute series_genres.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def series_genres @series_genres end |
#series_id ⇒ Object
Returns the value of attribute series_id.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def series_id @series_id end |
#series_title ⇒ Object
Returns the value of attribute series_title.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def series_title @series_title end |
#show_type ⇒ Object
Returns the value of attribute show_type.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def show_type @show_type end |
#showing_bits ⇒ Object
Returns the value of attribute showing_bits.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def showing_bits @showing_bits end |
#source_size ⇒ Object
Returns the value of attribute source_size.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def source_size @source_size end |
#star_rating ⇒ Object
Returns the value of attribute star_rating.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def @star_rating end |
#start_time ⇒ Object
Returns the value of attribute start_time.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def start_time @start_time end |
#stop_time ⇒ Object
Returns the value of attribute stop_time.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def stop_time @stop_time end |
#time ⇒ Object
Returns the value of attribute time.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def time @time end |
#title ⇒ Object
Returns the value of attribute title.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def title @title end |
#tv_rating ⇒ Object
Returns the value of attribute tv_rating.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def @tv_rating end |
#writers ⇒ Object
Returns the value of attribute writers.
24 25 26 |
# File 'lib/tivohmo/api/metadata.rb', line 24 def writers @writers end |
Instance Method Details
#estimate_source_size ⇒ Object
101 102 103 104 105 106 107 108 109 |
# File 'lib/tivohmo/api/metadata.rb', line 101 def estimate_source_size # This is needed so that we can give tivo an estimate of transcoded size # so transfer doesn't abort half way through. Using the max audio and # video bit rates for a max estimate opts = item.transcoder. vbr = (opts[:video_bitrate] || opts[:video_max_bitrate] || 30000) * 1000 abr = (opts[:audio_bitrate] || 448) * 1000 (self.duration * ((abr + vbr) * 1.02 / 8)).to_i end |
#initialize(item) ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/tivohmo/api/metadata.rb', line 74 def initialize(item) self.item = item self.duration = 0 self.showing_bits = 4096 self.is_episode = true self.recording_quality = {name: "HIGH", value: "75"} self.color_code = {name: 'COLOR', value: '4'} self.show_type = {name: 'SERIES', value: '5'} self.channel = {major_number: '0', minor_number: '0', callsign: ''} end |