Class: Ehbrs::Tools::Runner::Videos::Languages::Track
- Inherits:
-
Labelized
- Object
- SimpleDelegator
- Labelized
- Ehbrs::Tools::Runner::Videos::Languages::Track
- Defined in:
- lib/ehbrs/tools/runner/videos/languages/track.rb
Constant Summary collapse
- BLANK_LANGUAGE =
'BLANK'
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Attributes inherited from Labelized
Instance Method Summary collapse
- #delete_ffmpeg_args ⇒ Object
- #extract_ffmpeg_args ⇒ Object
- #extract_target ⇒ Object
- #included? ⇒ Boolean
-
#initialize(runner, object, file) ⇒ Track
constructor
A new instance of Track.
- #language ⇒ Object
Methods inherited from Labelized
Constructor Details
#initialize(runner, object, file) ⇒ Track
Returns a new instance of Track.
16 17 18 19 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 16 def initialize(runner, object, file) super(runner, object) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
14 15 16 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 14 def file @file end |
Instance Method Details
#delete_ffmpeg_args ⇒ Object
21 22 23 24 25 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 21 def delete_ffmpeg_args return [] if included? ['-map', "-0:#{index}"] end |
#extract_ffmpeg_args ⇒ Object
27 28 29 30 31 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 27 def extract_ffmpeg_args return [] unless included? ['-map', "0:#{index}", extract_target] end |
#extract_target ⇒ Object
41 42 43 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 41 def extract_target file.basename_sub('.*') { |b| "#{b}.#{language}_#{index}.srt" } end |
#included? ⇒ Boolean
33 34 35 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 33 def included? runner.keep_languages.include?(language) end |
#language ⇒ Object
37 38 39 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 37 def language language_with_title.presence || BLANK_LANGUAGE end |