class RakeMKV::Title

Title

Constants

HOUR
MINUTE

Attributes

chapter_count[R]
code[R]
duration[R]
id[R]
size[R]

Public Class Methods

new(id, options = {}) click to toggle source

Initialize with a required id

# File lib/rakemkv/title.rb, line 9
def initialize(id, options = {})
  # These claim to start at 1, but the CLI treats them as starting from 0
  @id = id
  @duration = options[:duration]
  @chapter_count = options[:chapter_count].to_i
  @size = options[:disk_size_bytes].to_i
end

Public Instance Methods

short_length?() click to toggle source

Find short lengthed title

# File lib/rakemkv/title.rb, line 18
def short_length?
  time > 900 && time < 2100
end
time() click to toggle source
# File lib/rakemkv/title.rb, line 22
def time
  time_from_integer || time_from_string
end

Private Instance Methods

time_from_integer() click to toggle source
# File lib/rakemkv/title.rb, line 30
def time_from_integer
  if duration.is_a? Integer
    duration
  end
end
time_from_string() click to toggle source
# File lib/rakemkv/title.rb, line 36
def time_from_string
  times = duration.split(':')
  (times[0].to_i * HOUR) + (times[1].to_i * MINUTE) + (times[2].to_i)
end