Spotify‐to‐Plex Setup Guide - ajgillis04/GillisDockerDepot GitHub Wiki
Spotify-to-Plex Setup Guide
Introduction
Spotify-to-Plex keeps your music library fresh by syncing your Spotify playlists directly into Plex. It automatically handles requests for missing tracks by pulling them from Lidarr or Soulseek. This service ensures your playlists stay updated without requiring manual intervention.
Step 1: Initial Container Deployment
- Add the following Spotify and Plex environment variables to your root .env file:
SPOTIFY_API_CLIENT_ID=your_client_id
SPOTIFY_API_CLIENT_SECRET=your_client_secret
PLEX_TOKEN=your_plex_token
SPOTIPLEX_PORT=9030
- Copy the service template into your active server directory:
cp compose/templates/spotifytoplex.yaml compose/server1/spotifytoplex.yaml
- Create the configuration directory:
sudo mkdir -p ${DOCKERDIR}/spotify-to-plex/config
- Launch the container:
docker compose -p mediaserver -f docker-compose-server1.yaml up -d spotify-to-plex
Step 2: Service Definition (spotifytoplex.yaml)
# ------------------------------------------------------------------------------
# spotify-to-plex - Sync Spotify playlists into Plex
# ------------------------------------------------------------------------------
services:
spotify-to-plex:
container_name: spotifytoplex.${HOST_NAME}
hostname: spotifytoplex.${HOST_NAME}.lan
image: jjdenhertog/spotify-to-plex:latest
environment:
TZ: ${TZ}
PUID: ${PUID}
PGID: ${PGID}
HOST_NAME: spotifytoplex.${HOST_NAME}.lan
# --- Spotify API credentials ---
SPOTIFY_API_CLIENT_ID: ${SPOTIFY_API_CLIENT_ID}
SPOTIFY_API_CLIENT_SECRET: ${SPOTIFY_API_CLIENT_SECRET}
SPOTIFY_API_REDIRECT_URI: http://127.0.0.1:9030/api/spotify/token
# --- Optional integrations ---
LIDARR_API_KEY: ${LIDARR_API_KEY}
SLSKD_API_KEY: ${LIDARR_API_KEY} # Reusing LIDARR_API_KEY for convenience
SLSKD_URL: http://soulseek.${HOST_NAME}:5030 # point to your slskd service
# --- Plex details ---
PLEX_URL: http://${SERVER_IP}:32400
PLEX_TOKEN: ${PLEX_TOKEN}
PLEX_APP_ID: eXf+f9ktw3CZ8i45OY468WxriOCtoFxuNPzVeDcAwfw=
# --- General options ---
PORT: 9030
LOG_LEVEL: INFO
SYNC_INTERVAL: 3600
networks:
- mediaserver
ports:
- "${SPOTIPLEX_PORT}:9030"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "7"
volumes:
- ${DOCKERDIR}/spotify-to-plex/config:/app/config
restart: on-failure:4
security_opt:
- no-new-privileges:true
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "homepage.group=Media"
- "homepage.name=Spotify-to-Plex"
- "homepage.icon=https://raw.githubusercontent.com/jjdenhertog/spotify-to-plex/main/icon.png"
- "homepage.href=http://spotifytoplex.${HOST_NAME}:${SPOTIPLEX_PORT}"
- "homepage.description=Sync Spotify playlists into Plex"
Step 3: Application Configuration
- Visit the Spotify Developer Dashboard to generate your Client ID and Client Secret.
- Ensure your Redirect URI is set to
http://127.0.0.1:9030/api/spotify/tokenin the Spotify dashboard. - Access the web interface at
http://<your-ip-address>:9030. - Complete the initial authorization flow inside the interface to link your Spotify and Plex accounts.
Step 4: Backup & Restore
Backing Up
Stop the service and compress the configuration directory:
docker compose -p mediaserver -f docker-compose-server1.yaml stop spotify-to-plex
tar -czvf spotifytoplex_backup.tar.gz ${DOCKERDIR}/spotify-to-plex/config
docker compose -p mediaserver -f docker-compose-server1.yaml start spotify-to-plex
Restoring
- Stop the container.
- Unpack the backup archive into the configuration directory.
- Restart the container.
Step 5: Troubleshooting
- If synchronization fails check your Plex URL and verify that the PLEX_TOKEN is valid.
- Ensure that the Redirect URI matches exactly what you entered in the Spotify Developer Dashboard.
- Check the logs if the sync interval passes without any updates:
docker logs -f spotifytoplex.${HOST_NAME}