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

Instance Method Summary collapse

Instance Attribute Details

#actorsObject

Returns the value of attribute actors.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def actors
  @actors
end

#actual_showingObject

Returns the value of attribute actual_showing.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def actual_showing
  @actual_showing
end

#advisoryObject

Returns the value of attribute advisory.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def advisory
  @advisory
end

#bookmarkObject

Returns the value of attribute bookmark.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def bookmark
  @bookmark
end

#channelObject

Returns the value of attribute channel.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def channel
  @channel
end

#choreographersObject

Returns the value of attribute choreographers.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def choreographers
  @choreographers
end

#color_codeObject

Returns the value of attribute color_code.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def color_code
  @color_code
end

#descriptionObject

Returns the value of attribute description.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def description
  @description
end

#directorsObject

Returns the value of attribute directors.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def directors
  @directors
end

#durationObject

Returns the value of attribute duration.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def duration
  @duration
end

#episode_numberObject

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_titleObject

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_producersObject

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_starsObject

Returns the value of attribute guest_stars.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def guest_stars
  @guest_stars
end

#hostsObject

Returns the value of attribute hosts.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def hosts
  @hosts
end

#is_episodeObject

Returns the value of attribute is_episode.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def is_episode
  @is_episode
end

#itemObject

Returns the value of attribute item.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def item
  @item
end

#movie_yearObject

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_ratingObject

Returns the value of attribute mpaa_rating.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def mpaa_rating
  @mpaa_rating
end

#original_air_dateObject

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_countObject

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_indexObject

Returns the value of attribute part_index.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def part_index
  @part_index
end

#producersObject

Returns the value of attribute producers.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def producers
  @producers
end

#program_genresObject

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_idObject

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_qualityObject

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_genresObject

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_idObject

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_titleObject

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_typeObject

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_bitsObject

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_sizeObject

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_ratingObject

Returns the value of attribute star_rating.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def star_rating
  @star_rating
end

#start_timeObject

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_timeObject

Returns the value of attribute stop_time.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def stop_time
  @stop_time
end

#timeObject

Returns the value of attribute time.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def time
  @time
end

#titleObject

Returns the value of attribute title.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def title
  @title
end

#tv_ratingObject

Returns the value of attribute tv_rating.



24
25
26
# File 'lib/tivohmo/api/metadata.rb', line 24

def tv_rating
  @tv_rating
end

#writersObject

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_sizeObject



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.transcoder_options
  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