Skip to content
Snippets Groups Projects
Commit 708b8646 authored by David Trattnig's avatar David Trattnig
Browse files

refact: improve structure, add docstrings

parent 0390ef5d
No related branches found
No related tags found
1 merge request!35ORM-less scheduling
...@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment