def power_states_activity(m: LogManager): timestamp = datetime.utcnow() m.clear_state(timestamp) context = device_context(timestamp) context.rcu_version = "** SCENARIO: POWER STATES **" m.push_event(context) power_on = PowerStatusEvent(timestamp, PowerStateType.POWER_ON, False) m.push_event(power_on) timestamp += timedelta(seconds=1) display_on = VideoOutputEvent(timestamp, True, '', '1.x', '1.x', '1080i', '50', '2b9c5d351a879a25b86851adc36acea6') m.push_event(display_on) timestamp += timedelta(seconds=1) player = PageViewEvent(timestamp, 'player') m.push_event(player) timestamp += timedelta(seconds=1) viewing_start = timestamp viewing_dur = 60 event = get_live_event() view_1 = make_live_play_event(timestamp, event) m.push_event(view_1) timestamp += timedelta(seconds=viewing_dur) stop_1 = make_live_stop_event(timestamp, viewing_start, event, viewing_dur) m.push_event(stop_1) standby = PageViewEvent(timestamp, 'standby') m.push_event(standby) power_standby = PowerStatusEvent(timestamp, PowerStateType.STANDBY, True) m.push_event(power_standby) display_off = VideoOutputEvent(timestamp, False) m.push_event(display_off) timestamp += timedelta(hours=8) active = PowerStatusEvent(timestamp, PowerStateType.ACTIVE, True) m.push_event(active) timestamp += timedelta(seconds=1) display_on.timestamp = timestamp m.push_event(display_on) timestamp += timedelta(seconds=1) player.timestamp = timestamp m.push_event(player)
def trickmode_viewing(m: LogManager): timestamp = datetime.utcnow() m.clear_state(timestamp) context = device_context(timestamp) context.rcu_version = "** SCENARIO: TRICKMODE VIEWING **" m.push_event(context) player = PageViewEvent(timestamp, 'player') m.push_event(player) viewing_start = timestamp f8d_events = request_channel_events('F8D') event = find_event_on_air(timestamp, f8d_events) view_1 = make_live_play_event(timestamp, event) m.push_event(view_1) offset = (timestamp - event.start_time).seconds remaining_duration = event.duration.seconds - offset offset += int(remaining_duration / 2) timestamp += timedelta(seconds=int(remaining_duration / 2)) stop = make_live_stop_event(timestamp, viewing_start, event, offset) m.push_event(stop) media = Media(content_type=ContentTypeType( ContentTypeType.TUNER_SUB_TRICKMODE), view_status=ViewStatusType(ViewStatusType.CAPTIONS), booking_source=None, event_source=None, create_timestamp=timestamp, duration=timestamp - viewing_start) playback_pause = make_playback_event(timestamp, viewing_start, event, media, offset, 0) m.push_event(playback_pause) pause_duration = timedelta(minutes=15) timestamp += pause_duration media.duration += pause_duration playback_play = make_playback_event(timestamp, viewing_start, event, media, offset, 1000) m.push_event(playback_play) timestamp += pause_duration media.duration += pause_duration pvr_stop = make_pvr_stop_event( timestamp, viewing_start, event, media, event.duration.seconds, (event.duration - (viewing_start - event.start_time)).seconds) m.push_event(pvr_stop)
def channel_surfing(m: LogManager): timestamp = datetime.utcnow() m.clear_state(timestamp) context = device_context(timestamp) context.rcu_version = "** SCENARIO: CHANNEL SURFING **" m.push_event(context) player = PageViewEvent(timestamp, 'player') m.push_event(player) viewing_start = timestamp f8d_events = request_channel_events('F8D') shc_events = request_channel_events('SHC') sha_events = request_channel_events('SHA') event = find_event_on_air(timestamp, f8d_events) view_1 = make_live_play_event(timestamp, event) m.push_event(view_1) timestamp = event.start_time + event.duration event = live_event_change(m, timestamp, event, find_event_on_air(timestamp, f8d_events), viewing_start) viewing_start = timestamp timestamp += timedelta(seconds=90) mini_guide = PageViewEvent(timestamp, 'miniGuide') m.push_event(mini_guide) timestamp += timedelta(seconds=5) event = live_event_change(m, timestamp, event, find_event_on_air(timestamp, shc_events), viewing_start) viewing_start = timestamp timestamp += timedelta(seconds=5) live_event_change(m, timestamp, event, find_event_on_air(timestamp, sha_events), viewing_start) timestamp += timedelta(seconds=5) player = PageViewEvent(timestamp, 'player') m.push_event(player)