Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
engine
Commits
063894aa
Commit
063894aa
authored
1 year ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
refactor: update fallback event, improve type info
parent
3d82b014
No related branches found
No related tags found
1 merge request
!35
ORM-less scheduling
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/aura_engine/engine.py
+6
-4
6 additions, 4 deletions
src/aura_engine/engine.py
src/aura_engine/events.py
+14
-6
14 additions, 6 deletions
src/aura_engine/events.py
with
20 additions
and
10 deletions
src/aura_engine/engine.py
+
6
−
4
View file @
063894aa
...
@@ -48,6 +48,8 @@ from aura_engine.resources import (
...
@@ -48,6 +48,8 @@ from aura_engine.resources import (
ResourceUtil
,
ResourceUtil
,
)
)
from
aura_engine.scheduling.domain
import
PlaylistItem
from
aura_engine.scheduling.domain
import
PlaylistItem
from
aura_engine.scheduling.scheduler
import
AuraScheduler
from
aura_engine.scheduling.timetable
import
TimetableService
class
Engine
:
class
Engine
:
...
@@ -59,7 +61,7 @@ class Engine:
...
@@ -59,7 +61,7 @@ class Engine:
logger
:
logging
.
Logger
logger
:
logging
.
Logger
config
:
confuse
.
Configuration
config
:
confuse
.
Configuration
engine_time_offset
=
0.0
engine_time_offset
=
0.0
scheduler
=
None
scheduler
:
AuraScheduler
=
None
event_dispatcher
=
None
event_dispatcher
=
None
client
=
None
client
=
None
playout
=
None
playout
=
None
...
@@ -144,9 +146,9 @@ class Engine:
...
@@ -144,9 +146,9 @@ class Engine:
state
=
DotDict
(
LU
.
json_to_dict
(
state
))
state
=
DotDict
(
LU
.
json_to_dict
(
state
))
def
dispatch_fallback_event
():
def
dispatch_fallback_event
():
time
slot
=
self
.
scheduler
.
timetable
.
get_current_timeslot
()
time
table
:
TimetableService
=
self
.
scheduler
.
get_timetable
()
fallback_show_name
=
self
.
config
.
general
.
fallback_show_name
timeslot
=
timetable
.
get_current_timeslot
()
self
.
event_dispatcher
.
on_fallback_active
(
timeslot
,
fallback_show_name
)
self
.
event_dispatcher
.
on_fallback_active
(
timeslot
)
# Initialize state
# Initialize state
if
not
self
.
playout_state
:
if
not
self
.
playout_state
:
...
...
This diff is collapsed.
Click to expand it.
src/aura_engine/events.py
+
14
−
6
View file @
063894aa
...
@@ -239,18 +239,26 @@ class EngineEventDispatcher:
...
@@ -239,18 +239,26 @@ class EngineEventDispatcher:
thread
=
Thread
(
target
=
func
,
args
=
(
self
,
channel
))
thread
=
Thread
(
target
=
func
,
args
=
(
self
,
channel
))
thread
.
start
()
thread
.
start
()
def
on_fallback_active
(
self
,
timeslot
,
fallback_name
):
def
on_fallback_active
(
self
,
timeslot
):
"""
"""
Call when a fallback is activated
for the given timeslot
.
Call when a fallback is activated.
This means there is no proper playlist scheduled.
Fallback means the station fallback audio source is played when:
1. no timeslot is available.
2. the current timefrome of the active timeslot provides no audio source/playlists.
TODO In the future case (1) should technically not happen, as
"
Virtual Timeslots
"
ensure
there is always some timeslot available, even without any playlists/media sources assigned.
Args:
timeslot (Timeslot): The active timeslot, if available. Can be `None`.
"""
"""
def
func
(
self
,
timeslot
,
fallback_type
):
def
func
(
self
,
timeslot
):
self
.
logger
.
debug
(
"
on_fallback_active(..)
"
)
self
.
logger
.
debug
(
"
on_fallback_active(..)
"
)
self
.
call_event
(
"
on_fallback_active
"
,
timeslot
,
fallback_type
)
self
.
call_event
(
"
on_fallback_active
"
,
timeslot
)
thread
=
Thread
(
target
=
func
,
args
=
(
self
,
timeslot
,
fallback_name
))
thread
=
Thread
(
target
=
func
,
args
=
(
self
,
timeslot
))
thread
.
start
()
thread
.
start
()
def
on_queue
(
self
,
items
:
list
):
def
on_queue
(
self
,
items
:
list
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment