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
29 30 31 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 29 def codec_tag ffprobe_data.fetch(:codec_tag).to_i(16) end |
#codec_type ⇒ Object
59 60 61 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 59 def codec_type ffprobe_data.fetch(:codec_type).to_sym end |
#duration ⇒ ActiveSupport::Duration?
34 35 36 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 34 def duration duration_from_root || end |
#language ⇒ Object
67 68 69 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 67 def language [:language] end |
#language_with_title ⇒ Object
71 72 73 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 71 def language_with_title [language, title].compact_blank.if_present { |v| v.join('_').variableize } end |
#tags ⇒ Object
63 64 65 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 63 def ffprobe_data[:tags].if_present({}, &:symbolize_keys) end |
#title ⇒ Object
75 76 77 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 75 def title [:title] end |
#to_h ⇒ Object
43 44 45 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 43 def to_h ffprobe_data end |
#to_s ⇒ String
39 40 41 |
# File 'lib/ehbrs_ruby_utils/videos/stream.rb', line 39 def to_s [index, codec_type, codec_name, language, codec_tag_string].join('|') end |