A Flask-based Video-on-Demand server with mobile-friendly responsive UI, folder navigation, pagination, and flexible configuration.
- Responsive mobile-friendly UI
- Video pagination with configurable items per page
- Folder navigation with sidebar
- URL-encoded video streaming
- Thumbnail generation
- Configuration system with defaults and overrides
- Warning system for problematic filenames
- Caching mechanism for directory scanning
- Python 3.7+
- Flask and dependencies (see
requirements.txt) - FFmpeg - Required for thumbnail generation and video processing
macOS (with Homebrew):
brew install ffmpegUbuntu/Debian:
sudo apt update
sudo apt install ffmpegWindows:
Download from https://ffmpeg.org/download.html or use package managers like Chocolatey:
choco install ffmpegVerify Installation:
ffmpeg -versionThe server uses Flask's configuration system with support for defaults and environment-specific overrides.
The default configuration is defined in app/default_config.py:
DEFAULT_VOD_CONFIG = {
"server": {
"port": 8080,
"host": "0.0.0.0",
"debug": False
},
"directories": {
"videos": "../vids",
"web_assets": "../www"
},
"video": {
"extensions": [".mp4", ".mov", ".mkv", ".avi", ".m4v", ".webm", ".flv", ".wmv"],
"per_page": 10
},
"cache": {
"ttl_seconds": 300
}
}Following Flask best practices, instance-specific configurations are stored in the instance/ folder:
-
Base Instance Configuration -
instance/config.py:# Flask configuration SECRET_KEY = "your-secret-key-here" # Change this in production! # Homehub Configuration VOD_CONFIG = { "server": { "port": 8082, "host": "0.0.0.0", "debug": False }, # Only include settings you want to override }
-
Environment-specific Configuration -
instance/config.development.py:# Development configuration SECRET_KEY = "dev-secret-key" VOD_CONFIG = { "server": { "port": 5000, "host": "127.0.0.1", "debug": True }, "cache": { "ttl_seconds": 30 # Short cache for development } }
Only settings you want to override need to be included. Any settings not specified will fall back to the defaults.
With default configuration (production):
python run.pyWith development configuration (loads instance/config.development.py):
python run.py -e developmentYou can create or edit instance/config.py and instance/config.development.py to override any settings for your environment.
The server follows a standard Flask application structure:
run.py: Application entry pointapp/: Main application package__init__.py: Flask app initializationroutes.py: Route definitions and handlersconfig.py: Configuration managementutils/: Utility modulesvideo_utils.py: Video processing utilitiescache_manager.py: Cache management and video listing
templates/: HTML templatesstatic/: Static assets (CSS, JS, etc.)
instance/: Instance-specific config (excluded from version control)
Once running, access the server in your web browser:
- Default URL:
http://localhost:8082/ - Replace 8082 with your configured port
To run the automated test suite install the dependencies and execute pytest:
pip install -r requirements.txt
pip install pytest
pytest -q
