Spotify to Plex is a tool that automatically synchronizes your user-created Spotify playlists with your Plex Media Server. It supports:
Prerequisites & DependenciesImportant Notice: As of November 27, 2024, the Spotify API no longer allows access to Spotify‑generated playlists (e.g. Daily Mix, Discover Weekly). Only user‑created playlists are supported.
Create a docker-compose.yaml
file:
services: spotify-to-plex: image: ghcr.io/lammersbjorn/spotify-to-plex:latest container_name: spotify-to-plex env_file: - .env restart: unless-stopped volumes: - ./cache:/cache # Persist cache data - ./logs:/app/logs # Persist logs healthcheck: test: ["CMD", "poetry", "run", "spotify-to-plex", "diagnose"] interval: 1m timeout: 10s retries: 3 start_period: 1m user: appuser
Create an .env
file:
curl -o .env https://raw.githubusercontent.com/lammersbjorn/spotify-to-plex/main/.env.example nano .env
Start the service:
Alternatively, use these Docker commands:
# Pull the latest image docker pull ghcr.io/lammersbjorn/spotify-to-plex:latest # Create a configuration file curl -o .env https://raw.githubusercontent.com/lammersbjorn/spotify-to-plex/main/.env.example # Edit the configuration file nano .env # Run the container docker run -d --name spotify-to-plex --env-file .env ghcr.io/lammersbjorn/spotify-to-plex:latest2. Local Python Installation
Install Poetry:
curl -sSL https://install.python-poetry.org | python3 -
Clone the repository and install dependencies:
git clone https://github.com/lammersbjorn/spotify-to-plex.git cd spotify-to-plex poetry install
Configure the application:
cp .env.example .env nano .env
Run the application help:
poetry run spotify-to-plex --help
Spotify API
Plex API
http://localhost:32400
)Lidarr API (Optional)
SPOTIFY_CLIENT_ID
Spotify Client ID - Yes SPOTIFY_CLIENT_SECRET
Spotify Client Secret - Yes PLEX_TOKEN
Plex authentication token - Yes PLEX_SERVER_URL
URL of your Plex server - Yes PLEX_REPLACE
Replace existing playlists false
No PLEX_USERS
Comma-separated Plex users Owner account No MANUAL_PLAYLISTS
Comma-separated Spotify playlist IDs - Only if LIDARR_SYNC=false
LIDARR_API_KEY
Lidarr API key - Only if LIDARR_SYNC=true
LIDARR_API_URL
Lidarr server URL - Only if LIDARR_SYNC=true
LIDARR_SYNC
Enable Lidarr sync false
No MAX_PARALLEL_PLAYLISTS
Maximum number of playlists to process in parallel 3
No FIRST_RUN
Run sync at container start false
No CRON_SCHEDULE
Schedule using cron syntax 0 1 * * *
No ENABLE_CACHE
Enable API response caching true
No CACHE_TTL
Cache time-to-live in seconds 3600
No CACHE_DIR
Custom cache directory path ~/.cache/spotify-to-plex
No
Sync playlists from Lidarr:
poetry run spotify-to-plex sync-lidarr-imports [--parallel/--no-parallel] [--parallel-count N] [--clear-caches]
Sync manually specified playlists:
poetry run spotify-to-plex sync-manual-lists [--parallel/--no-parallel] [--parallel-count N] [--clear-caches]
Sync a specific playlist by ID:
poetry run spotify-to-plex sync-playlist PLAYLIST_ID [--clear-caches]
Clear caches:
poetry run spotify-to-plex clear-caches
Run diagnostics:
poetry run spotify-to-plex diagnose
Manual sync:
docker exec spotify-to-plex poetry run spotify-to-plex sync-manual-lists
View logs:
docker logs spotify-to-plex
Updating the container:
docker pull ghcr.io/lammersbjorn/spotify-to-plex:latest docker rm -f spotify-to-plex docker run -d --name spotify-to-plex --env-file .env ghcr.io/lammersbjorn/spotify-to-plex:latest
Or, if using Docker Compose:
docker compose pull docker compose up -d
PLEX_REPLACE=true
in your .env
to have playlists deleted and recreated on each sync.--parallel
and --parallel-count
options.ENABLE_CACHE
and adjust CACHE_TTL
(in seconds) in your .env
file.CRON_SCHEDULE
(default is 0 1 * * *
) in your .env
using standard cron syntax:
0 */6 * * *
0 0 * * 1
*/30 * * * *
/cache
(persisted via Docker volume)./app/logs
(configure your host paths in Docker Compose as desired).404 Not Found Errors:
No Tracks in Plex:
API Authentication Errors:
.env
.Processing Stalls (0%):
--no-parallel
option.diagnose
command to examine connections.clear-caches
.Run the diagnostics to verify Spotify and Plex connections, cache status, and configuration integrity:
poetry run spotify-to-plex diagnose
docker logs spotify-to-plex
.spotify_to_plex.log
or logs under /app/logs
).GPL-3.0 License — see the LICENSE file for details.
Disclaimer: This project is not affiliated with or endorsed by Spotify or Plex. Use this tool in accordance with the terms of use of each service.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4