5.2 KiB
Plex Playlist Sync
A web-based tool to sync your Spotify playlists with your Plex Music Library. Upload CSV exports from Spotify, match tracks with your Plex library, and create playlists automatically.
Features
- Easy CSV Upload: Drag and drop Spotify playlist CSV exports
- Smart Track Matching: Fuzzy matching algorithm finds the best tracks in your Plex library
- Multiple Playlists: Process multiple CSV files at once, either as separate playlists or merged into one
- Web Interface: Clean, modern UI built with Flask and Bootstrap
- Docker Support: Run easily in a containerized environment
Prerequisites
- Python 3.9+ (or Docker)
- Plex Media Server with music library
- Spotify playlist CSV export (via Exportify or similar)
Quick Start
Option 1: Local Installation
- Clone the repository:
git clone https://github.com/yourusername/plexsync.git
cd plexsync
- Install dependencies:
pip install -r requirements.txt
- Run the application:
Windows:
start.bat
Linux/Mac:
chmod +x start.sh
./start.sh
Or manually:
python app.py
- Open your browser to
http://localhost:5000
Option 2: Docker
docker-compose up -d
The app will be available at http://localhost:5000
How to Use
1. Export Your Spotify Playlist
- Go to Exportify or similar service
- Login with your Spotify account
- Select the playlist you want to export
- Download as CSV
2. Get Your Plex Token
- Sign in to Plex Web
- Click your profile icon → Account Settings
- Click Web in the left sidebar under Account
- Look for
X-Plex-Tokenin the URL - Copy everything after
X-Plex-Token=
⚠️ Security: Keep your token private - it provides access to your Plex server!
3. Configure and Sync
- Open Plex Playlist Sync in your browser
- Enter your Plex server URL (usually
http://localhost:32400for local) - Paste your Plex token
- Upload your CSV file(s)
- Choose whether to create unified or separate playlists
- Review matched tracks and create your playlists!
Want High-Quality Music? Check Out SpotiFLAC!
Before syncing, you might want to download your Spotify playlists in maximum quality. SpotiFLAC is a tool that lets you download Spotify playlists in FLAC/MP3 quality.
Workflow:
- Use SpotiFLAC to download your Spotify playlists in high quality
- Add the downloaded music folder to your Plex music library
- Scan your Plex library to import the new tracks
- Use Plex Playlist Sync to match and create playlists from your Spotify CSV exports
This gives you the best of both worlds: Spotify's curated playlists with high-quality audio files in Plex!
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 5000 |
FLASK_DEBUG |
Enable debug mode | 0 |
PLEX_BASE_URL |
Your Plex server URL | - |
PLEX_TOKEN |
Your Plex auth token | - |
Docker Volume
The uploads folder is mounted as a volume for persistent CSV storage:
volumes:
- ./uploads:/app/uploads
Project Structure
plexsync/
├── app.py # Main Flask application
├── plexsync.py # Track matching logic
├── requirements.txt # Python dependencies
├── start.bat # Windows startup script
├── start.sh # Linux/Mac startup script
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
├── static/ # Static assets (CSS, JS, images)
├── templates/ # Jinja2 HTML templates
└── uploads/ # Uploaded CSV storage
Dependencies
- Flask 2.x
- Flask-Session
- PlexAPI
- python-dotenv
- unidecode
- Werkzeug
See requirements.txt for full list and versions.
Security Notes
- Change the secret key in
app.pybefore deploying to production - Use HTTPS when accessing over the internet
- Never share your Plex token
- The app includes CSRF protection and secure session handling
Troubleshooting
"Could not connect to Plex server"
- Verify your Plex URL is correct
- Check that your token is valid
- Ensure Plex server is running and accessible
"No tracks found"
- Make sure your music is added to a Plex music library
- Run a library scan in Plex first
- Check CSV format matches expected columns (Track Name, Artist Name)
Match accuracy issues
- Ensure your Plex library has good metadata
- Try refreshing metadata for problematic albums in Plex
- The matching algorithm handles minor spelling variations but needs recognizable track/artist names
License
MIT License - see LICENSE file for details
Acknowledgments
- PlexAPI for the Python Plex interface
- Exportify for Spotify playlist export functionality
- SpotiFLAC for high-quality music downloads
- Bootstrap and Bootstrap Icons for the UI
Contributing
Contributions welcome! Please open an issue or pull request.
