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
84592ce0
Commit
84592ce0
authored
1 year ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
refactor: add update playlist method
parent
20399adc
No related branches found
No related tags found
1 merge request
!35
ORM-less scheduling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/aura_engine/scheduling/domain.py
+22
-1
22 additions, 1 deletion
src/aura_engine/scheduling/domain.py
with
22 additions
and
1 deletion
src/aura_engine/scheduling/domain.py
+
22
−
1
View file @
84592ce0
...
...
@@ -34,6 +34,7 @@ import enum
from
typing
import
NamedTuple
from
aura_engine
import
resources
from
aura_engine.base.lang
import
synchronized
from
aura_engine.base.utils
import
SimpleUtil
as
SU
from
aura_engine.core.channels
import
GenericChannel
...
...
@@ -146,6 +147,7 @@ class Playlist:
"""
return
self
.
shuffle
@synchronized
def
add
(
self
,
item
:
PlaylistItem
)
->
None
:
"""
Add an item to the playlist.
...
...
@@ -165,6 +167,25 @@ class Playlist:
item
.
set_playlist
(
self
)
self
.
items
.
append
(
item
)
@synchronized
def
update_playlist
(
self
,
playlist
:
Playlist
):
"""
Update the playlist data with the one passed.
It is important to avoid overwriting any local references, as they might be already in use
of scheduling threads.
Args:
playlist (Playlist): Playlist with fresh data.
"""
self
.
id
=
playlist
.
id
self
.
desc
=
playlist
.
desc
self
.
shuffle
=
playlist
.
shuffle
self
.
items
=
playlist
.
get_items
()
item
:
PlaylistItem
for
item
in
self
.
get_items
():
item
.
set_playlist
(
self
)
def
__str__
(
self
)
->
str
:
"""
String representation.
...
...
@@ -311,7 +332,7 @@ class Timeslot:
self
.
playlist
=
Playlists
(
timeslot
=
pl_timeslot
,
schedule
=
pl_schedule
,
show
=
pl_show
)
def
get_current_playlist
(
self
):
def
get_current_playlist
(
self
)
->
Playlist
:
"""
Retrieve the playlist to be scheduled.
...
...
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