A minimal UPnP/DLNA media streamer with web dashboard for managing and streaming videos to DLNA devices.
nano-dlna lets you play local media files on your DLNA-compatible devices (TVs, projectors, etc.) with both CLI and web-based interfaces. It's designed to be simple, reliable, and flexible.
🦀 Note: Also check out crab-dlna, a Rust implementation of nano-dlna.
-
Device Management:
- Auto-discover DLNA devices on your network
- Manual configuration of devices
- View device status and connection info
-
Video Management:
- Stream videos to any DLNA device
- Upload and manage video files
- Scan directories for videos
-
Playback Control:
- Play, pause, stop video playback
- Seek to specific positions
- Loop videos automatically
-
Auto-Play:
- Automatically play videos on specific devices
- Device-video mapping via configuration files
- Continuous monitoring and reconnection
-
Multiple Interfaces:
- Web dashboard for visual management
- CLI for command-line operations
- REST API for integration with other tools
pip install nanodlna
git clone https://github.com/gabrielmagno/nano-dlna.git
cd nano-dlna
pip install -e .
The web dashboard provides a user-friendly interface for managing devices and videos.
# Start the dashboard
./run_dashboard.sh
# Stop the dashboard
./stop_dashboard.sh
This will start both the backend API and the frontend web interface:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Devices Page: View and manage discovered DLNA devices
- Videos Page: Upload, sc 8000 an, and manage your video library
- Play Page: Select a device and video to play
- Device Configuration: Set up automatic video assignments
The CLI allows you to manage devices and videos directly from the terminal.
# List available DLNA devices
nanodlna list
# Play a video on a device
nanodlna play video.mp4 -q "TV"
# Play with device URL (faster, no scan)
nanodlna play video.mp4 -d "http://192.168.1.13:1082/"
# Seek to a specific position
nanodlna seek -q "TV" "00:17:25"
Several helper scripts are available:
# Run the auto-play functionality
./run_nanodlna.sh
# Cast to a specific transcreen projector
./cast_to_transcreen.sh
# Run both the nanodlna app and web interface
./run_all.sh
The primary configuration file is my_device_config.json
, which maps devices to videos:
[
{
"device_name": "LivingRoomTV",
"type": "dlna",
"hostname": "192.168.1.100",
"video_file": "/path/to/video.mp4"
},
{
"device_name": "BedroomTV",
"type": "dlna",
"hostname": "192.168.1.101",
"video_file": "/path/to/another_video.mp4"
}
]
You can configure auto-play behavior in several ways:
- Manual Assignment via the web interface
- Configuration Files with device-video mappings
- Scheduled Playback using the web dashboard
Several utility scripts are available to help manage the system:
python clean_videos.py
Cleans up the database by removing non-existent videos and handling duplicates.
python add_config_videos.py
Adds videos from the configuration files to the database.
python scan_videos.py --directory "/path/to/videos" --recursive
Scans a directory for videos and adds them to the database.
python fix_device.py --device "DeviceName"
Attempts to fix issues with a specific device.
-
Devices not discovered
- Ensure devices are on the same network
- Check firewall settings
- Try increasing discovery timeout:
nanodlna -t 20 list
-
Videos won't play
- Check that file paths in configuration are correct
- Verify video format is compatible (H.264 MP4 is most reliable)
- Check network connectivity
-
Web Dashboard Issues
- Clear browser cache
- Restart the dashboard
- Check backend logs for errors
For more serious issues:
-
Enable verbose logging:
export NANODLNA_DEBUG=1
-
Check the log files:
cat nanodlna.log
-
Clean the database:
python clean_videos.py
nano-dlna functions as both a DLNA MediaServer (to serve your media files) and a MediaController (to send commands to your devices).
The auto-play system works by:
- Loading device configurations from JSON files
- Discovering devices on the network
- Matching discovered devices with configurations
- Starting media servers for video streaming
- Sending play commands to matched devices
- Continuously monitoring playback and reconnecting as needed
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request