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
708b8646
Commit
708b8646
authored
1 year ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
refact: improve structure, add docstrings
parent
0390ef5d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+84
-36
84 additions, 36 deletions
src/aura_engine/scheduling/domain.py
with
84 additions
and
36 deletions
src/aura_engine/scheduling/domain.py
+
84
−
36
View file @
708b8646
...
@@ -19,11 +19,17 @@
...
@@ -19,11 +19,17 @@
"""
"""
Domain models for scheduling.
Domain models for scheduling.
These domain models are defined:
- Timeslot: A timetable entry.
- Playlist: Definition of what should be broadcasted for one timeslot.
- PlaylistType: What kind of playlist it is. Either assigned to timeslot, schedule or show.
- PlaylistEntry: An element of the playlist, referencing media sources and metadata.
"""
"""
from
__future__
import
annotations
from
__future__
import
annotations
import
datetime
import
enum
import
enum
from
aura_engine.core.channels
import
GenericChannel
from
aura_engine.core.channels
import
GenericChannel
...
@@ -34,44 +40,72 @@ from aura_engine.scheduling.utils import EntryQueueState
...
@@ -34,44 +40,72 @@ from aura_engine.scheduling.utils import EntryQueueState
class
Timeslot
:
class
Timeslot
:
"""
"""
A timeslot in the programme calendar.
A timeslot in the programme calendar.
Beside references to playlists, it holds show and episode metadata.
Note, some episodes values are inherited from the show,
some others are overridden by the episode.
Attributes:
id (int): Timeslot ID as used in Steering and Tank
repetition_of_id (int): In case of a re-broadcast it holds a reference
to another timeslot ID.
start: beginning of timeslot as UNIX epoch.
end: ending of timeslot as UNIX epoch.
paylist_timeslot (Playlist): Playlist assigned directly to the timeslot.
playlist_schedule (Playlist): Playlist assigned to the schedule.
paylist_show (Playlist): Playlist assigned to the show.
show_id (int): Show ID as used in Steering and Tank.
show_name (str): Name of the show.
episode_host (list[str]): List of hosts.
episode_type (list[str]): List of types.
episode_cat (list[str]): List of categories.
episode_funding_cat (list[str]): List of funding categories.
episode_language (list[str]): List of languages.
episode_topic (list[str]): List of topics.
episode_music_focus (list[str]): List of music genres.
episode_memo: Some notes for the (internal, non-public use only).
"""
"""
id
:
int
id
:
int
repetition_of_id
=
int
repetition_of_id
=
int
start
:
datetime
start
:
int
end
:
datetime
end
:
int
memo
:
str
show
:
Show
playlist_timeslot
:
Playlist
playlist_timeslot
:
Playlist
playlist_schedule
:
Playlist
playlist_schedule
:
Playlist
playlist_show
:
Playlist
playlist_show
:
Playlist
show_id
:
int
show_name
:
str
class
Show
:
episode_host
:
list
[
str
]
"""
episode_type
:
list
[
str
]
The show assigned to the timeslot.
episode_cat
:
list
[
str
]
"""
episode_funding_cat
:
list
[
str
]
episode_language
:
list
[
str
]
id
:
int
episode_topic
:
list
[
str
]
name
:
str
episode_music_focus
:
list
[
str
]
hosts
:
list
[
str
]
episode_memo
:
str
type
:
list
[
str
]
category
:
list
[
str
]
funding_category
:
list
[
str
]
language
:
list
[
str
]
topic
:
list
[
str
]
musicfocus
:
list
[
str
]
class
Playlist
:
class
Playlist
:
"""
"""
The playlist assigned to a timeslot.
The playlist assigned to a timeslot.
Attributes:
id (int): Playlist ID as used in Steering and Tank.
timeslot (Timeslot): Back reference to the timeslot.
type (PlaylistType): Indicating type of timeslot playlist.
count (int): Count of playlist entries.
entries (PlaylistEntry): List of entries.
"""
"""
id
:
int
timeslot
:
Timeslot
timeslot
:
Timeslot
type
:
PlaylistType
type
:
PlaylistType
id
:
int
count
:
int
count
:
int
entries
:
PlaylistEntry
entries
:
PlaylistEntry
...
@@ -79,6 +113,11 @@ class Playlist:
...
@@ -79,6 +113,11 @@ class Playlist:
class
PlaylistType
(
enum
):
class
PlaylistType
(
enum
):
"""
"""
Playlist type defines where it is assigned to the timeslot.
Playlist type defines where it is assigned to the timeslot.
Attributes:
TIMESLOT (str): (TIMESLOT) The playlist is assigned to the timeslot itself.
SCHEDULE (str): (SCHEDULE) The playlist is assigned to the schedule.
SHOW (str): (SHOW) The playlist is assigned to the show.
"""
"""
TIMESLOT
=
"
playlist_timeslot
"
TIMESLOT
=
"
playlist_timeslot
"
...
@@ -89,27 +128,36 @@ class PlaylistType(enum):
...
@@ -89,27 +128,36 @@ class PlaylistType(enum):
class
PlaylistEntry
:
class
PlaylistEntry
:
"""
"""
The entries of a playlist.
The entries of a playlist.
Attributes:
playlist (str): Back reference to playlist.
index (int): The index in the playlist.
start (int): The start of the entry as UNIX epoch.
duration (int): Duration in milliseconds.
volume (int): Value from 0-100% indicating loudness.
source (str): URI referencing the audio source.
meta_artist (str): The artist.
meta_album (str): The album.
meta_title (str): The title.
play_channel (GenericChannel): Play-out channel, set when entry is starts playing.
play_queue_state (EntryQueueState): Progress on queuing, set when entry is queued.
play_status (Player.EntryPlayState): Play-out state, set when playing starts.
"""
"""
playlist
:
Playlist
playlist
:
Playlist
index
:
int
index
:
int
start
:
datetime
start
:
int
duration
:
int
duration
:
int
volume
:
int
volume
:
int
source
:
str
source
:
str
channel
:
GenericChannel
# Assigned when entry is actually playing
meta_artist
:
str
queue_state
:
EntryQueueState
# Assigned when entry is about to be queued
meta_album
:
str
status
:
Player
.
EntryPlayState
# Assigned when state changes
meta_title
:
str
metadata
:
Metadata
class
Metadata
:
"""
The metadata of an playlist entry.
"""
artist
:
str
play_channel
:
GenericChannel
title
:
str
play_queue_state
:
EntryQueueState
album
:
str
play_status
:
Player
.
EntryPlayState
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