Class: HandBrake::Chapter

Inherits:
Object
  • Object
show all
Includes:
ConstructWithProperties, DurationAsSeconds
Defined in:
lib/handbrake/disc.rb

Overview

The metadata about a single chapter in a title of a DVD.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from ConstructWithProperties

#initialize

Methods included from DurationAsSeconds

#seconds

Instance Attribute Details

#durationString

Returns The duration of the title in the format "hh:mm:ss".

Returns:

  • (String)

    The duration of the title in the format "hh:mm:ss"



223
224
225
# File 'lib/handbrake/disc.rb', line 223

def duration
  @duration
end

#numberFixnum

Returns The chapter number for this chapter (a positive integer).

Returns:

  • (Fixnum)

    The chapter number for this chapter (a positive integer)



228
229
230
# File 'lib/handbrake/disc.rb', line 228

def number
  @number
end

#titleTitle

Returns The title that contains this chapter.

Returns:

  • (Title)

    The title that contains this chapter



232
233
234
# File 'lib/handbrake/disc.rb', line 232

def title
  @title
end

Class Method Details

.from_tree(chapter_node) ⇒ Chapter

Creates a new instance from the given title subtree.

Parameters:

  • chapter_node (Tree::TreeNode)

Returns:

  • (Chapter)

    a new, fully initialized instance

See Also:



240
241
242
243
244
245
# File 'lib/handbrake/disc.rb', line 240

def self.from_tree(chapter_node)
  self.new.tap do |ch|
    ch.duration = chapter_node.name.scan(/duration (\d\d:\d\d:\d\d)/).first.first
    ch.number = chapter_node.name.scan(/(\d+): cells/).first.first.to_i
  end
end