Class: Poms::Broadcast
- Inherits:
-
Poms::Builder::NestedOpenStruct
- Object
- OpenStruct
- Poms::Builder::NestedOpenStruct
- Poms::Broadcast
- Includes:
- HasAncestors, HasBaseAttributes
- Defined in:
- lib/poms/broadcast.rb
Direct Known Subclasses
Instance Method Summary collapse
- #available_until ⇒ Object
-
#initialize(hash) ⇒ Broadcast
constructor
A new instance of Broadcast.
- #odi_streams ⇒ Object
- #process_schedule_events ⇒ Object
- #series_mid ⇒ Object
Methods included from HasBaseAttributes
Methods included from HasAncestors
Methods included from Base
Constructor Details
#initialize(hash) ⇒ Broadcast
Returns a new instance of Broadcast.
10 11 12 13 |
# File 'lib/poms/broadcast.rb', line 10 def initialize hash super process_schedule_events end |
Instance Method Details
#available_until ⇒ Object
35 36 37 38 39 |
# File 'lib/poms/broadcast.rb', line 35 def available_until return nil if locations.nil? or locations.empty? = locations.map(&:publish_stop).compact.first return Time.at( / 1000).to_datetime if end |
#odi_streams ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/poms/broadcast.rb', line 26 def odi_streams return [] if locations.nil? or locations.empty? odi_streams = locations.select { |l| l.program_url.match(/^odi/) } streams = odi_streams.map do |l| l.program_url.match(/^[\w+]+\:\/\/[\w\.]+\/video\/(\w+)\/\w+/)[1] end streams.uniq end |
#process_schedule_events ⇒ Object
15 16 17 18 19 20 |
# File 'lib/poms/broadcast.rb', line 15 def process_schedule_events if schedule_events schedule_events.select! { |e| e.channel.match Poms::VALID_CHANNELS } end self.schedule_events = schedule_events.map { |e| Poms::ScheduleEvent.new e.marshal_dump } if schedule_events end |
#series_mid ⇒ Object
22 23 24 |
# File 'lib/poms/broadcast.rb', line 22 def series_mid serie.try :mid_ref || serie.mid end |