Class: RakeMKV::Title

Inherits:
Object
  • Object
show all
Defined in:
lib/rakemkv/title.rb

Overview

Title

Constant Summary collapse

MINUTE =
60
HOUR =
3600

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, options = {}) ⇒ Title

Initialize with a required id



9
10
11
12
13
14
15
# 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

Instance Attribute Details

#chapter_countObject (readonly)

Returns the value of attribute chapter_count.



3
4
5
# File 'lib/rakemkv/title.rb', line 3

def chapter_count
  @chapter_count
end

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/rakemkv/title.rb', line 3

def code
  @code
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/rakemkv/title.rb', line 3

def id
  @id
end

#sizeObject (readonly)

Returns the value of attribute size.



3
4
5
# File 'lib/rakemkv/title.rb', line 3

def size
  @size
end

Instance Method Details

#short_length?Boolean

Find short lengthed title

Returns:

  • (Boolean)


18
19
20
# File 'lib/rakemkv/title.rb', line 18

def short_length?
  time > 900 && time < 2100
end

#timeObject



22
23
24
# File 'lib/rakemkv/title.rb', line 22

def time
  time_from_integer || time_from_string
end