Class: Musical::DVD::Chapter
- Inherits:
-
Object
- Object
- Musical::DVD::Chapter
- Includes:
- Util
- Defined in:
- lib/musical/dvd/chapter.rb
Constant Summary collapse
- DEFAULT_CHAPTER_NUMBER =
1
- DEFAULT_CHAPTER_NAME =
'default chapter name'
- DEFAULT_TITLE_NUMBER =
1
Constants included from Util
Instance Attribute Summary collapse
-
#chapter_number ⇒ Object
Returns the value of attribute chapter_number.
-
#name ⇒ Object
Returns the value of attribute name.
-
#vob_path ⇒ Object
Returns the value of attribute vob_path.
Instance Method Summary collapse
-
#initialize(vob_path, options = {}) ⇒ Chapter
constructor
A new instance of Chapter.
- #to_wav(wav_path = "#{Musical.configuration.output}/chapter_#{@title_number}_#{@chapter_number}.wav") ⇒ Object
Methods included from Util
#check_env, #execute_command, #installed?
Constructor Details
#initialize(vob_path, options = {}) ⇒ Chapter
Returns a new instance of Chapter.
12 13 14 15 16 17 18 19 |
# File 'lib/musical/dvd/chapter.rb', line 12 def initialize(vob_path, = {}) raise ArgumentError.new 'VOB path is not given' if vob_path.nil? @vob_path = vob_path @name = [:name] || DEFAULT_CHAPTER_NAME @chapter_number = [:chapter_number] || DEFAULT_CHAPTER_NUMBER @title_number = [:title_number] || DEFAULT_TITLE_NUMBER end |
Instance Attribute Details
#chapter_number ⇒ Object
Returns the value of attribute chapter_number.
6 7 8 |
# File 'lib/musical/dvd/chapter.rb', line 6 def chapter_number @chapter_number end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/musical/dvd/chapter.rb', line 6 def name @name end |
#vob_path ⇒ Object
Returns the value of attribute vob_path.
6 7 8 |
# File 'lib/musical/dvd/chapter.rb', line 6 def vob_path @vob_path end |
Instance Method Details
#to_wav(wav_path = "#{Musical.configuration.output}/chapter_#{@title_number}_#{@chapter_number}.wav") ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/musical/dvd/chapter.rb', line 21 def to_wav(wav_path = "#{Musical.configuration.output}/chapter_#{@title_number}_#{@chapter_number}.wav") return @wav if @wav command = "ffmpeg -i #{@vob_path} -ac 2 #{wav_path}" execute_command(command, true) DVD::Wav.new(wav_path) end |