Files
Ske_Signage/README.md
2025-07-16 08:03:57 +03:00

243 lines
6.2 KiB
Markdown

# SKE Digital Signage Server
A modern, web-based digital signage management system built with Flask. This is a completely restructured and improved version of the original digiserver application.
## Features
- **Modern Architecture**: Clean, modular Flask application structure
- **User Management**: Role-based authentication (admin/user)
- **Player Management**: Individual digital signage displays
- **Group Management**: Organize players into groups for synchronized content
- **Content Management**: Upload and manage images, videos, and documents
- **RESTful API**: For player clients to fetch playlists
- **Docker Support**: Easy deployment with Docker and Docker Compose
- **Responsive UI**: Bootstrap-based modern interface
- **File Processing**: Automatic conversion of PDFs, PowerPoint, and videos
- **Audit Logging**: Track all system actions
## Quick Start with Docker
1. **Clone and Navigate**:
```bash
cd /home/pi/Ske_Signage
```
2. **Configure Environment** (optional):
```bash
cp .env.example .env
# Edit .env file with your preferred settings
```
3. **Build and Start**:
```bash
docker-compose up -d
```
4. **Access the Application**:
- Open your browser to `http://localhost:8880`
- Default login: `admin` / `ChangeMe123!`
## Manual Installation
### Prerequisites
- Python 3.11+
- SQLite3
- FFmpeg
- LibreOffice
- Poppler-utils
### Installation Steps
1. **Install System Dependencies** (Ubuntu/Debian):
```bash
sudo apt-get update
sudo apt-get install -y libreoffice poppler-utils ffmpeg \
libpoppler-cpp-dev libmagic1 libffi-dev libssl-dev \
g++ libjpeg-dev zlib1g-dev libxml2-dev libxslt-dev
```
2. **Create Virtual Environment**:
```bash
python3 -m venv venv
source venv/bin/activate
```
3. **Install Python Dependencies**:
```bash
pip install -r requirements.txt
```
4. **Configure Environment**:
```bash
cp .env.example .env
# Edit .env with your settings
```
5. **Initialize Database**:
```bash
python main.py
# This will create the database and default admin user
```
6. **Run Application**:
```bash
python main.py
```
## Application Structure
```
Ske_Signage/
├── app/ # Main application package
│ ├── models/ # Database models
│ ├── routes/ # Flask blueprints/routes
│ ├── utils/ # Utility functions
│ ├── templates/ # Jinja2 templates
│ ├── static/ # Static files (uploads, assets)
│ ├── __init__.py # Application factory
│ └── extensions.py # Flask extensions
├── config.py # Configuration classes
├── main.py # Application entry point
├── requirements.txt # Python dependencies
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
└── .env.example # Environment template
```
## Configuration
The application uses environment variables for configuration. Key settings:
- `SECRET_KEY`: Flask secret key for sessions
- `ADMIN_USER` / `ADMIN_PASSWORD`: Default admin credentials
- `DATABASE_URL`: Database connection string
- `FLASK_CONFIG`: Environment (development/production)
- `HOST` / `PORT`: Server binding
## API Endpoints
### Player API
- `GET /api/playlists`: Get playlist for a player
- `GET /api/playlist_version`: Check playlist version
- `POST /api/player_status`: Update player status
- `GET /api/health`: Health check
### Authentication
All API endpoints require player authentication via hostname and quickconnect code.
## Usage
### 1. Create Players
1. Login as admin
2. Go to Dashboard
3. Click "Add Player"
4. Fill in player details (username, hostname, passwords)
### 2. Upload Content
1. Click "Upload Content"
2. Select target (player or group)
3. Choose files (images, videos, PDFs, PowerPoint)
4. Set display duration
5. Upload
### 3. Manage Groups
1. Create groups to synchronize content across multiple players
2. Add players to groups
3. Upload content to groups for synchronized playlists
### 4. Player Client
Players can connect using the API:
```bash
curl "http://server:8880/api/playlists?hostname=PLAYER_HOSTNAME&quickconnect_code=CODE"
```
## File Processing
The application automatically processes uploaded files:
- **Images**: Resized and optimized
- **Videos**: Converted to web-compatible MP4 format
- **PDFs**: Converted to individual page images
- **PowerPoint**: Converted to images via LibreOffice
## Development
### Running in Development Mode
```bash
export FLASK_CONFIG=development
export FLASK_DEBUG=true
python main.py
```
### Database Migrations
```bash
flask db init # Initialize migrations (first time)
flask db migrate # Create migration
flask db upgrade # Apply migration
```
## Production Deployment
### Docker Compose (Recommended)
1. Use the provided `docker-compose.yml`
2. Set strong passwords in environment variables
3. Configure reverse proxy (nginx/traefik) for HTTPS
4. Set up backup for persistent volumes
### Manual Deployment
1. Use a production WSGI server (gunicorn included)
2. Set `FLASK_CONFIG=production`
3. Configure proper database (PostgreSQL recommended for production)
4. Set up log rotation
5. Configure firewall and security
## Security Considerations
- Change default admin credentials
- Use strong secret keys
- Enable HTTPS in production
- Regular backups
- Monitor logs for suspicious activity
- Keep dependencies updated
## Troubleshooting
### Common Issues
1. **File Upload Errors**: Check file permissions and disk space
2. **Video Conversion Fails**: Ensure FFmpeg is installed and accessible
3. **PDF Processing Issues**: Verify poppler-utils installation
4. **Database Errors**: Check database file permissions
### Logs
- Application logs: Check console output or `logs/` directory
- Docker logs: `docker-compose logs -f`
## Migrating from Original digiserver
The new application uses a different database schema. To migrate:
1. Export content from old system
2. Create players and groups in new system
3. Re-upload content through the new interface
## License
This project is proprietary software for SKE Digital Signage.
## Support
For issues and support, please contact the development team.