Replace emoji icons with local SVG files for consistent rendering

- Created 10 SVG icon files in app/static/icons/ (Feather Icons style)
- Updated base.html with SVG icons in navigation and dark mode toggle
- Updated dashboard.html with icons in stats cards and quick actions
- Updated content_list_new.html (playlist management) with SVG icons
- Updated upload_media.html with upload-related icons
- Updated manage_player.html with player management icons
- Icons use currentColor for automatic theme adaptation
- Removed emoji dependency for better Raspberry Pi compatibility
- Added ICON_INTEGRATION.md documentation
This commit is contained in:
ske087
2025-11-13 21:00:07 +02:00
parent e5a00d19a5
commit 498c03ef00
37 changed files with 4240 additions and 840 deletions

View File

@@ -2,6 +2,7 @@
from app.models.user import User
from app.models.player import Player
from app.models.group import Group, group_content
from app.models.playlist import Playlist, playlist_content
from app.models.content import Content
from app.models.server_log import ServerLog
from app.models.player_feedback import PlayerFeedback
@@ -10,8 +11,10 @@ __all__ = [
'User',
'Player',
'Group',
'Playlist',
'Content',
'ServerLog',
'PlayerFeedback',
'group_content',
'playlist_content',
]

View File

@@ -3,7 +3,6 @@ from datetime import datetime
from typing import Optional, List
from app.extensions import db
from app.models.group import group_content
class Content(db.Model):
@@ -13,31 +12,26 @@ class Content(db.Model):
id: Primary key
filename: Original filename
content_type: Type of content (image, video, pdf, presentation, other)
duration: Display duration in seconds
duration: Default display duration in seconds
file_size: File size in bytes
description: Optional content description
position: Display order position
uploaded_at: Upload timestamp
"""
__tablename__ = 'content'
id = db.Column(db.Integer, primary_key=True)
filename = db.Column(db.String(255), nullable=False, index=True)
filename = db.Column(db.String(255), nullable=False, unique=True, index=True)
content_type = db.Column(db.String(50), nullable=False, index=True)
duration = db.Column(db.Integer, default=10, nullable=True)
file_size = db.Column(db.BigInteger, nullable=True)
description = db.Column(db.Text, nullable=True)
position = db.Column(db.Integer, default=0, index=True)
uploaded_at = db.Column(db.DateTime, default=datetime.utcnow,
nullable=False, index=True)
# Player relationship (for direct player assignment)
player_id = db.Column(db.Integer, db.ForeignKey('player.id', ondelete='CASCADE'),
nullable=True, index=True)
# Relationships
player = db.relationship('Player', back_populates='contents')
groups = db.relationship('Group', secondary=group_content,
# Relationships - many-to-many with playlists
playlists = db.relationship('Playlist', secondary='playlist_content',
back_populates='contents', lazy='dynamic')
groups = db.relationship('Group', secondary='group_content',
back_populates='contents', lazy='dynamic')
def __repr__(self) -> str:

View File

@@ -32,7 +32,6 @@ class Group(db.Model):
onupdate=datetime.utcnow, nullable=False)
# Relationships
players = db.relationship('Player', back_populates='group', lazy='dynamic')
contents = db.relationship('Content', secondary=group_content,
back_populates='groups', lazy='dynamic')
@@ -40,10 +39,7 @@ class Group(db.Model):
"""String representation of Group."""
return f'<Group {self.name} (ID={self.id})>'
@property
def player_count(self) -> int:
"""Get number of players in this group."""
return self.players.count()
@property
def content_count(self) -> int:

View File

@@ -16,10 +16,10 @@ class Player(db.Model):
auth_code: Authentication code for API access (legacy)
password_hash: Hashed password for player authentication
quickconnect_code: Hashed quick connect code for easy pairing
group_id: Foreign key to assigned group
orientation: Display orientation (Landscape/Portrait)
status: Current player status (online, offline, error)
last_seen: Last activity timestamp
playlist_version: Version number for playlist synchronization
created_at: Player creation timestamp
"""
__tablename__ = 'player'
@@ -31,20 +31,20 @@ class Player(db.Model):
auth_code = db.Column(db.String(255), unique=True, nullable=False, index=True)
password_hash = db.Column(db.String(255), nullable=False)
quickconnect_code = db.Column(db.String(255), nullable=True)
group_id = db.Column(db.Integer, db.ForeignKey('group.id'), nullable=True, index=True)
orientation = db.Column(db.String(16), default='Landscape', nullable=False)
status = db.Column(db.String(50), default='offline', index=True)
last_seen = db.Column(db.DateTime, nullable=True, index=True)
last_heartbeat = db.Column(db.DateTime, nullable=True, index=True)
playlist_version = db.Column(db.Integer, default=1, nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow, nullable=False)
# Playlist assignment
playlist_id = db.Column(db.Integer, db.ForeignKey('playlist.id', ondelete='SET NULL'),
nullable=True, index=True)
# Relationships
group = db.relationship('Group', back_populates='players')
playlist = db.relationship('Playlist', back_populates='players')
feedback = db.relationship('PlayerFeedback', back_populates='player',
cascade='all, delete-orphan', lazy='dynamic')
contents = db.relationship('Content', back_populates='player',
cascade='all, delete-orphan', lazy='dynamic')
def __repr__(self) -> str:
"""String representation of Player."""

97
app/models/playlist.py Normal file
View File

@@ -0,0 +1,97 @@
"""Playlist model for managing content collections."""
from datetime import datetime
from typing import List, Optional
from app.extensions import db
# Association table for many-to-many relationship between playlists and content
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)
)
class Playlist(db.Model):
"""Playlist model representing a collection of content.
Attributes:
id: Primary key
name: Unique playlist name
description: Optional playlist description
version: Version number for synchronization
is_active: Whether playlist is active
created_at: Playlist creation timestamp
updated_at: Last modification timestamp
"""
__tablename__ = 'playlist'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False, unique=True, index=True)
description = db.Column(db.Text, nullable=True)
orientation = db.Column(db.String(20), default='Landscape', nullable=False)
version = db.Column(db.Integer, default=1, nullable=False)
is_active = db.Column(db.Boolean, default=True, nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow, nullable=False)
updated_at = db.Column(db.DateTime, default=datetime.utcnow,
onupdate=datetime.utcnow, nullable=False)
# Relationships
players = db.relationship('Player', back_populates='playlist', lazy='dynamic')
contents = db.relationship('Content', secondary=playlist_content,
back_populates='playlists', lazy='dynamic')
def __repr__(self) -> str:
"""String representation of Playlist."""
return f'<Playlist {self.name} (ID={self.id}, Version={self.version})>'
@property
def player_count(self) -> int:
"""Get number of players assigned to this playlist."""
return self.players.count()
@property
def content_count(self) -> int:
"""Get number of content items in this playlist."""
return self.contents.count()
@property
def total_duration(self) -> int:
"""Calculate total duration of all content in seconds."""
total = 0
for content in self.contents:
total += content.duration or 10
return total
def increment_version(self) -> None:
"""Increment playlist version for sync detection."""
self.version += 1
self.updated_at = datetime.utcnow()
def get_content_ordered(self) -> List:
"""Get content items ordered by position."""
# Query through association table to get position
from sqlalchemy import select
stmt = select(playlist_content.c.content_id,
playlist_content.c.position,
playlist_content.c.duration).where(
playlist_content.c.playlist_id == self.id
).order_by(playlist_content.c.position)
results = db.session.execute(stmt).fetchall()
ordered_content = []
for row in results:
content = db.session.get(Content, row.content_id)
if content:
content._playlist_position = row.position
content._playlist_duration = row.duration
ordered_content.append(content)
return ordered_content
# Import Content here to avoid circular import
from app.models.content import Content