Sha256: d8d23129d9ecbcdf97aec3f85ef42e5f0a3bc37029c7c54d4c13675e2ff97a99
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
require 'poms/has_ancestors' require 'poms/has_base_attributes' module Poms class Broadcast < Poms::Builder::NestedOpenStruct include Poms::HasAncestors include Poms::HasBaseAttributes def initialize hash super process_schedule_events end 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 def series_mid serie.try :mid_ref || serie.mid end 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 def available_until return if predictions.blank? timestamp = offline_timestamp(predictions) return Time.at(timestamp / 1000).to_datetime if timestamp end private def offline_timestamp(predictions, platform = 'INTERNETVOD') timestamps = predictions.map do |p| p.publish_stop if p.platform == platform end.compact timestamps.first unless timestamps.empty? end end class Strand < Broadcast end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
poms-0.0.10 | lib/poms/broadcast.rb |
poms-0.0.9 | lib/poms/broadcast.rb |