6.8 KiB
Moonlight Drive-In Setup Guide
Complete setup instructions for the Moonlight Drive-In theater system.
📋 Prerequisites
System Requirements
- Operating System: Windows 10/11 (primary), Linux (experimental)
- Python: Version 3.8 or higher
- MPV: Media player library
- NFC Reader: ACS ACR122 or compatible USB reader
Hardware Setup
- Connect NFC reader to USB port
- Connect display/projector
- Ensure stable network connection (for web interface)
🔧 Installation
Step 1: Install Python Dependencies
# Install all required packages
pip install -r web_requirements.txt
# Or install individually
pip install python-mpv flask flask-socketio pynput psutil
Step 2: Install MPV Player
Windows:
- Download MPV from https://mpv.io/installation/
- Extract to
C:\DriveIn\mpv\or update PATH in batch files - Ensure
mpv.exeis in system PATH
Linux:
sudo apt install mpv python3-mpv
Step 3: Configure Directories
The system will auto-create required directories on first run:
videos/
├── trailers/ # Trailer video files
├── specific/ # Single movie files
└── groupvideos/ # Folder sequences
🎬 Video Setup
Adding Trailers
- Place trailer videos in
videos/trailers/ - Supported formats: .mp4, .avi, .mov, .mkv, .wmv, .flv, .webm, .m4v
- Trailers play randomly between movies
Adding Single Movies
- Place movie files in
videos/specific/ - Note the filename (without extension)
- Map to NFC tags in
videos/key_mapping.txt
Example:
videos/specific/avengers-endgame.mp4
Mapping in videos/key_mapping.txt:
12345678,avengers-endgame
Creating Folder Sequences
For multi-part movies or series:
- Create a folder in
videos/groupvideos/
videos/groupvideos/LOTR/
- Add numbered videos:
videos/groupvideos/LOTR/01_fellowship.mp4
videos/groupvideos/LOTR/02_towers.mp4
videos/groupvideos/LOTR/03_return.mp4
- Map to NFC in
videos/folder_mapping.txt:
11111111,LOTR
- Each NFC scan plays the next video in sequence!
🏷️ NFC Configuration
Reading NFC IDs
Use the debug console's "NFC Test" field to read your tags:
- Start the player
- Click in the "NFC Test" field
- Scan your NFC tag
- The ID will appear in the field
- Copy this ID for your mapping files
Mapping Files
videos/key_mapping.txt - Single videos:
# Format: NFC_ID, Movie_Name
12345678,avengers
87654321,spider-man
videos/folder_mapping.txt - Folder sequences:
# Format: NFC_ID, Folder_Name
11111111,LOTR
22222222,Avengers
Validation
Run the validation script to check your setup:
python validate.bat
This checks:
- All video files exist
- Mapping files are valid
- NFC IDs are properly configured
- Reports missing files
🚀 Running the System
Basic Mode (MPV Only)
# Windows
movie.bat
# Or directly
python mpv_main_fixed.py
Web Interface Mode
# Windows
start_web_player.bat
# Or directly
python web_mpv_main.py
Access web interface at:
- Local: http://localhost:8547
- Network: http://[your-ip]:8547
Features Available
Debug Console:
- Real-time log viewing
- Manual NFC testing
- Quick controls
- Statistics display
- Folder sequence reset
Web Interface:
- Multi-page dashboard
- Statistics page
- Control page
- Video selection
- System management
🎮 Usage
Playing Videos
- NFC Scan: Simply scan an NFC tag to play mapped video
- Manual Selection: Use web interface to select videos
- Trailers: Play automatically between movies
Folder Sequences
- Scan NFC tag to play first video in sequence
- Video plays to completion
- Returns to trailer mode
- Next scan plays second video
- Continues through sequence, then loops
Controls
Keyboard (when focused):
- Numbers + Enter: Manual NFC input
Web Interface:
- Skip Video
- Toggle Fullscreen
- Mute/Unmute
- Manual video selection
Debug Console:
- Skip Video button
- Toggle Fullscreen
- Mute/Unmute
- Reset Folder Sequences
🔧 Troubleshooting
NFC Reader Not Working
- Check USB connection
- Verify driver installation
- Test with NFC Test field in debug console
- Check global input capture status
Videos Won't Play
- Run validation script
- Check video format is supported
- Verify file paths in mapping files
- Check MPV is installed and in PATH
Web Interface Not Accessible
- Check firewall allows port 8547
- Verify Flask and Flask-SocketIO installed
- Check IP address is correct for network access
- Try http://localhost:8547 first
Folder Sequences Not Advancing
- Check folder_state.json in videos folder
- Use "Reset Folder Sequences" in debug console
- Verify folder structure is correct
- Check videos are named in correct order
📊 Advanced Configuration
Changing Web Port
Edit web_mpv_main.py:
web_port = 8547 # Change to your preferred port
Or pass as command line argument:
python web_mpv_main.py 9000
Custom Video Directories
Edit paths in config.py:
VIDEOS_DIR = BASE_DIR / "videos"
TRAILERS_DIR = VIDEOS_DIR / "trailers"
Anti-Repeat Settings
Edit mpv_seamless_player.py:
self.max_recent_trailers = 36 # Don't repeat within last N plays
Logging Level
Edit config.py:
LOG_LEVEL = logging.DEBUG # Change to INFO, WARNING, or ERROR
🔄 Maintenance
Reloading Mappings
Without restart:
- Edit mapping files
- Use web interface → System → Reload Mappings
- Or press "Reload Mappings" in debug console
Clearing Folder State
To restart all sequences from beginning:
- Debug Console → "Reset Folder Sequences" button
- Or delete
videos/folder_state.json
Log Files
Logs stored in logs/ directory:
- Named by timestamp
- Rotated automatically
- Contains detailed debugging info
📝 Best Practices
- File Naming: Use numbers for ordering (01_, 02_, etc.)
- Video Formats: Prefer .mp4 for compatibility
- Backup Mappings: Keep copies of mapping files
- Test First: Use validation script before deployment
- Network: Use static IP for consistent web access
🆘 Support
Check the logs in logs/ directory for detailed error messages.
Run diagnostics:
python folder_diagnostic.py # Check folder structure
python validate_videos.py # Validate complete setup
🎯 Quick Start Checklist
- Python 3.8+ installed
- MPV player installed
- Required packages installed (
pip install -r web_requirements.txt) - Videos placed in appropriate directories
- NFC tags mapped in configuration files
- Validation script run successfully
- Test with manual NFC input
- Web interface accessible
- NFC reader connected and working
You're ready to go! 🎬