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

refact: playlist as str, fix prev and init

parent 96e9bed1
No related branches found
No related tags found
1 merge request!35ORM-less scheduling
...@@ -165,6 +165,19 @@ class Playlist: ...@@ -165,6 +165,19 @@ class Playlist:
item.playlist = self item.playlist = self
self.items.append(item) self.items.append(item)
def __str__(self) -> str:
"""
String representation.
Returns:
str: Playlist as String.
"""
s = f"ID#{self.id} | {self.get_duration()}seconds"
if self.desc:
s += f" ({self.desc})"
return s
Playlists = NamedTuple( Playlists = NamedTuple(
"Playlists", [("timeslot", Playlist), ("schedule", Playlist), ("show", Playlist)] "Playlists", [("timeslot", Playlist), ("schedule", Playlist), ("show", Playlist)]
...@@ -256,7 +269,7 @@ class Timeslot: ...@@ -256,7 +269,7 @@ class Timeslot:
self.end = end self.end = end
self.show = show self.show = show
self.episode = episode self.episode = episode
self.playlist = None self.playlist = Playlists(None, None, None)
def get_id(self) -> int: def get_id(self) -> int:
""" """
...@@ -478,6 +491,8 @@ class PlaylistItem: ...@@ -478,6 +491,8 @@ class PlaylistItem:
self.volume = volume self.volume = volume
self.metadata = metadata self.metadata = metadata
self.play_queue_state = PlaylistItem.QueueState.OKAY
def get_playlist(self) -> Playlist: def get_playlist(self) -> Playlist:
""" """
Get the playlist of this item. Get the playlist of this item.
...@@ -563,7 +578,7 @@ class PlaylistItem: ...@@ -563,7 +578,7 @@ class PlaylistItem:
prev = self.get_prev() prev = self.get_prev()
if prev: if prev:
all_prev = prev.get_all_prev() all_prev = prev.get_all_prev()
all_prev.append(self) all_prev.append(prev)
return all_prev return all_prev
return [] return []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment