Commit dc266ce7 authored by David Trattnig's avatar David Trattnig
Browse files

Added properties required by Scheduling Logic.

parent 9bd00661
......@@ -281,9 +281,32 @@ class PlaylistEntry(DB.Model, AuraDatabaseModel):
def select_playlistentry_for_playlist(artificial_playlist_id, entry_num):
return DB.session.query(PlaylistEntry).filter(PlaylistEntry.artificial_playlist_id == artificial_playlist_id, PlaylistEntry.entry_num == entry_num).first()
# @hybrid_property
# def start_unix(self):
# return time.mktime(self.entry_start.timetuple())
@hybrid_property
def start_unix(self):
return time.mktime(self.entry_start.timetuple())
def volume(self):
return 100
@hybrid_property
def type(self):
if self.uri.startswith("http"):
return ScheduleEntryType.STREAM
if self.uri.startswith("pool") or self.uri.startswith("playlist") or self.uri.startswith("file"):
return ScheduleEntryType.FILESYSTEM
if self.uri.startswith("live") or self.uri.startswith("linein"):
if self.cleansource == "0":
return ScheduleEntryType.LIVE_0
elif self.cleansource == "1":
return ScheduleEntryType.LIVE_1
elif self.cleansource == "2":
return ScheduleEntryType.LIVE_2
elif self.cleansource == "3":
return ScheduleEntryType.LIVE_3
elif self.cleansource == "4":
return ScheduleEntryType.LIVE_4
# ------------------------------------------------------------------------------------------ #
class PlaylistEntryMetaData(DB.Model, AuraDatabaseModel):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment