diff --git a/libraries/database/broadcasts.py b/libraries/database/broadcasts.py index dd7a25d4f6ba52790d3ebb240662f6e55993529b..7fcc5b3ecce4ec2eb880222e6b66f254a6c91468 100644 --- a/libraries/database/broadcasts.py +++ b/libraries/database/broadcasts.py @@ -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):