Module: Rapid::Model::Structures

Defined in:
lib/ury_rapid/model/structures/module_set.rb,
lib/ury_rapid/model/structures/playout_model.rb

Defined Under Namespace

Classes: ModuleSet

Class Method Summary collapse

Class Method Details

.channel_bodyProc

Returns a proc for generating the body of a channel

This may be invoked directly by playout services that own precisely one channel.

Returns:

  • (Proc)

    A proc that may be instance_eval'd into an #insert_components stanza.


18
19
20
21
22
23
24
25
26
# File 'lib/ury_rapid/model/structures/playout_model.rb', line 18

def self.channel_body
  player   = Structures.player
  playlist = Structures.playlist

  lambda do |*|
    instance_eval(&player)
    instance_eval(&playlist)
  end
end

.channel_set_tree(channel_ids) ⇒ Proc

Returns a proc for generating a channel set

Parameters:

  • channel_ids (Array)

    An array of the IDs of the channels available in this playout system.

Returns:

  • (Proc)

    A proc that may be instance_eval'd into an #insert_components stanza.


57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ury_rapid/model/structures/playout_model.rb', line 57

def self.channel_set_tree(channel_ids)
  fail 'Nil channel IDs array given.' if channel_ids.nil?

  channel_body = Structures.channel_body

  lambda do |*|
    tree :channels, :channel_set do
      channel_ids.each do |channel_id|
        tree(channel_id, :channel) { instance_eval(&channel_body) }
      end
    end
  end
end

.playerProc

Returns a proc for generating a player tree

Returns:

  • (Proc)

    A proc that may be instance_eval'd into an #insert_components stanza.


32
33
34
35
36
37
38
39
40
41
# File 'lib/ury_rapid/model/structures/playout_model.rb', line 32

def self.player
  lambda do |*|
    tree :player, :player do
      play_state :state, :stopped
      load_state :load_state, :empty
      volume :volume, 0.0
      Rapid::Common::Types::MARKERS.each { |m| marker m, m, 0 }
    end
  end
end

.playlistProc

Returns a proc for generating a playlist

Returns:

  • (Proc)

    A proc that may be instance_eval'd into an #insert_components stanza.


47
48
49
# File 'lib/ury_rapid/model/structures/playout_model.rb', line 47

def self.playlist
  lambda { |*| list :playlist, :playlist }
end

.playout_model(channel_ids) ⇒ Proc

A basic model structure for playout system services

This contains:

- A channel set, with IDs set in the model config under 'players'
- A playlist set, with IDs set in the model config under 'playlists'

Parameters:

  • channel_ids (Array)

    An array of the IDs of the channels available in this playout system.

Returns:

  • (Proc)

    A proc that may be instance_eval'd into an #insert_components stanza.


81
82
83
84
85
86
87
# File 'lib/ury_rapid/model/structures/playout_model.rb', line 81

def self.playout_model(channel_ids)
  channel_set_tree = Structures.channel_set_tree(channel_ids)

  lambda do |*|
    instance_eval(&channel_set_tree)
  end
end