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.
13 14 15 16 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 13 def initialize(runner, object, file) super(runner, object) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
11 12 13 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 11 def file @file end |
Instance Method Details
#delete_ffmpeg_args ⇒ Object
18 19 20 21 22 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 18 def delete_ffmpeg_args return [] if included? ['-map', "-0:#{index}"] end |
#extract_ffmpeg_args ⇒ Object
24 25 26 27 28 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 24 def extract_ffmpeg_args return [] unless included? ['-map', "0:#{index}", extract_target] end |
#extract_target ⇒ Object
38 39 40 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 38 def extract_target file.basename_sub('.*') { |b| "#{b}.#{language}_#{index}.srt" } end |
#included? ⇒ Boolean
30 31 32 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 30 def included? runner.keep_languages.include?(language) end |
#language ⇒ Object
34 35 36 |
# File 'lib/ehbrs/tools/runner/videos/languages/track.rb', line 34 def language language_with_title.presence || BLANK_LANGUAGE end |