Class: ActiveEncode::EngineAdapters::MatterhornRtmpUrl

Inherits:
Object
  • Object
show all
Defined in:
lib/active_encode/engine_adapters/matterhorn_adapter.rb

Constant Summary collapse

REGEX =
%r{^
  /(?<application>.+)        # application (avalon)
  /(?:(?<prefix>.+):)?       # prefix      (mp4:)
  (?<media_id>[^\/]+)        # media_id    (98285a5b-603a-4a14-acc0-20e37a3514bb)
  /(?<stream_id>[^\/]+)      # stream_id   (b3d5663d-53f1-4f7d-b7be-b52fd5ca50a3)
  /(?<filename>.+?)          # filename    (MVI_0057)
  (?:\.(?<extension>.+))?$   # extension   (mp4)
}x

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(match_data) ⇒ MatterhornRtmpUrl

Returns a new instance of MatterhornRtmpUrl.

Parameters:

  • match_data (MatchData)

306
307
308
309
310
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 306

def initialize(match_data)
  self.class.members.each do |key|
    send("#{key}=", match_data[key])
  end
end

Class Method Details

.parse(url_string) ⇒ Object


312
313
314
315
316
317
318
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 312

def self.parse(url_string)
  # Example input: /avalon/mp4:98285a5b-603a-4a14-acc0-20e37a3514bb/b3d5663d-53f1-4f7d-b7be-b52fd5ca50a3/MVI_0057.mp4

  uri = URI.parse(url_string)
  match_data = REGEX.match(uri.path)
  MatterhornRtmpUrl.new match_data
end

Instance Method Details

#_bindingObject


320
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 320

alias _binding binding

#bindingObject


321
322
323
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 321

def binding
  _binding
end

#to_pathObject


325
326
327
# File 'lib/active_encode/engine_adapters/matterhorn_adapter.rb', line 325

def to_path
  File.join(media_id, stream_id, "#{filename}.#{extension || prefix}")
end