updated view and playlist management
This commit is contained in:
@@ -10,7 +10,8 @@ playlist_content = db.Table('playlist_content',
|
||||
db.Column('playlist_id', db.Integer, db.ForeignKey('playlist.id', ondelete='CASCADE'), primary_key=True),
|
||||
db.Column('content_id', db.Integer, db.ForeignKey('content.id', ondelete='CASCADE'), primary_key=True),
|
||||
db.Column('position', db.Integer, default=0),
|
||||
db.Column('duration', db.Integer, default=10)
|
||||
db.Column('duration', db.Integer, default=10),
|
||||
db.Column('muted', db.Boolean, default=True)
|
||||
)
|
||||
|
||||
|
||||
@@ -76,7 +77,8 @@ class Playlist(db.Model):
|
||||
from sqlalchemy import select
|
||||
stmt = select(playlist_content.c.content_id,
|
||||
playlist_content.c.position,
|
||||
playlist_content.c.duration).where(
|
||||
playlist_content.c.duration,
|
||||
playlist_content.c.muted).where(
|
||||
playlist_content.c.playlist_id == self.id
|
||||
).order_by(playlist_content.c.position)
|
||||
|
||||
@@ -88,6 +90,7 @@ class Playlist(db.Model):
|
||||
if content:
|
||||
content._playlist_position = row.position
|
||||
content._playlist_duration = row.duration
|
||||
content._playlist_muted = row.muted if len(row) > 3 else True
|
||||
ordered_content.append(content)
|
||||
|
||||
return ordered_content
|
||||
|
||||
Reference in New Issue
Block a user