Class: EhbrsRubyUtils::Videos::Stream
- Inherits:
-
Object
- Object
- EhbrsRubyUtils::Videos::Stream
- Defined in:
- lib/ehbrs_ruby_utils/videos/stream.rb
Constant Summary collapse
- DURATION_TAG_TO_SECONDS_PARSER =
/\A(\d{2}):(\d{2}):(\d{2}.\d+)\z/.to_parser do |m| (m[1].to_i * 3600) + (m[2].to_i * 60) + m[3].to_f end
Instance Method Summary collapse
- #codec_tag ⇒ Integer
- #codec_type ⇒ Object
- #duration ⇒ ActiveSupport::Duration?
- #language ⇒ Object
- #language_with_title ⇒ Object
- #tags ⇒ Object
- #title ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ String
Instance Method Details
#codec_tag ⇒ Integer
27 28 29 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 27 def codec_tag ffprobe_data.fetch(:codec_tag).to_i(16) end |
#codec_type ⇒ Object
57 58 59 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 57 def codec_type ffprobe_data.fetch(:codec_type).to_sym end |
#duration ⇒ ActiveSupport::Duration?
32 33 34 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 32 def duration duration_from_root || end |
#language ⇒ Object
65 66 67 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 65 def language [:language] end |
#language_with_title ⇒ Object
69 70 71 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 69 def language_with_title [language, title].compact_blank.if_present { |v| v.join('_').variableize } end |
#tags ⇒ Object
61 62 63 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 61 def ffprobe_data[:tags].if_present({}, &:symbolize_keys) end |
#title ⇒ Object
73 74 75 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 73 def title [:title] end |
#to_h ⇒ Object
41 42 43 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 41 def to_h ffprobe_data end |
#to_s ⇒ String
37 38 39 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 37 def to_s [index, codec_type, codec_name, language, codec_tag_string].join('|') end |