lib/handbrake/titles.rb in handbrake-0.0.1 vs lib/handbrake/titles.rb in handbrake-0.0.2
- old
+ new
@@ -165,17 +165,23 @@
# @return [String] The duration of the title in the format
# "hh:mm:ss"
attr_accessor :duration
##
+ # @return [Fixnum] The chapter number for this chapter (a positive
+ # integer)
+ attr_accessor :number
+
+ ##
# Creates a new instance from the given title subtree.
#
# @see Title.from_tree
# @param [Tree::TreeNode] chapter_node
# @return [Chapter] a new, fully initialized instance
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
end
end