This is an old revision of the document!
Spotizerr
Spotizerr is an amazing self-hosted web service that let's you download and search for music from Deezer and Spotify.
While i do not recomend to use it, as it's against those services ToS, it seems to be working pretty well at least if you have a premium account.
Installation
Sporizerr is provided as a docker image that can be easily run with rootless podman. Due to this, it's important to properly setup credentials and storage locations.
As usual, create a dedicated user and associate it to the media group so that downloaded files will be accessible to the other media services:
useradd -d /data/daemons/spotizerr -m spotizerr -g media mkdir /data/Media/spotizerr mkdir /data/Media/spotizerr/downloads mkdir /var/log/spotizerr chown spotizerr:media /var/log/spotizerr su - spotizerr mkdir creds mkdir config wget https://raw.githubusercontent.com/Xoconoch/spotizerr/refs/heads/main/docker-compose.yml
Now edit the default docker compose to adapt it to your needs. You can follow my docker compose:
- docker-compose.yml
name: spotizerr services: spotizerr: volumes: - /data/daemons/spotizerr/creds:/app/creds - /data/daemons/spotizerr/config:/app/config - /data/Media/spotizerr/downloads:/app/downloads - /var/log/spotizerr:/app/logs ports: - 7171:7171 image: cooldockerizer93/spotizerr container_name: spotizerr-app environment: # - PUID=1000 # podman rootless needs PUID=0, or removed like this # - PGID=1000 # podman rootless needs PGID=0, or removed like this - UMASK=0002 # allow all users in media group to access music downloaded by spotizerr - REDIS_HOST=redis - REDIS_PORT=6379 - REDIS_DB=0 - REDIS_URL=redis://redis:6379/0 - REDIS_BACKEND=redis://redis:6379/0 - EXPLICIT_FILTER=false # Set to true to filter out explicit content depends_on: - redis networks: - spotizerr-net redis: image: redis:alpine container_name: spotizerr-redis volumes: - redis-data:/data command: redis-server --appendonly yes networks: - spotizerr-net volumes: redis-data: driver: local networks: spotizerr-net: {}
PUID and PGID sohuld be omitted or set to 0, because i am using rootless podman and not docker. This ensure that the user running the container is actually the spotizerr user, which is what we want.
Now pull the image:
podman compose pull
Reverse Proxy
Spotizerr seems to be working only on subdomain and not on subpath. I assume you have spotizerr.mydomain.com. See the F) The Reverse Proxy concept for more details.
- spotizerr.conf
server { server_name spotizerr.mydomain.com; listen 443 ssl; listen 8443 ssl; http2 on; access_log /var/log/nginx/spotizerr.mydomain.com_access_log main; error_log /var/log/nginx/spotizerr.mydomain.com_error_log info; include "com.mydomain/authelia_location.conf"; location / { include "com.mydomain/authelia_proxy.conf"; include "com.mydomain/authelia_authrequest.conf"; proxy_pass http://127.0.0.1:7171/; proxy_set_header Connection $http_connection; proxy_set_header Upgrade $http_upgrade; } include org.gardiol/certbot.conf; } Please note that Spotizerr does not provide **any** authentication or protection: you **must** put your SSO (see [[selfhost:sso|here]]) and HTTPS on top of it using the reverse proxy as in the above config example.
Configuration
You need to have your Spotify app on the phone and on the same network as the server.
it clone --depth 1 https://github.com/dspearson/librespot-auth.git podman run --rm -v "$(pwd)/librespot-auth":/app -w /app rust:latest cargo build --release ./librespot-auth/target/release/librespot-auth --name "mySpotifyAccount1" --class=computer
open the app and add the device called mySpotifyAccount1 This file has the following format:
{“username”: “string” “auth_type”: 1 “auth_data”: “string”}
The important ones are the “username” and “auth_data” parameters, these match the “username” and “credentials” sections respectively when adding/editing spotify credentials in Spotizerr.
In the terminal, you can directly print these parameters using jq:
jq -r '.username, .auth_data' credentials.json
see here
work in progress
Autostart
To start it, and set it up on boot, as usual follow my indications Using Containers on Gentoo, so link the user-containers init script:
ln -s /etc/init.d/user-containers /etc/init.d/user-containers.spotizerr
and create the following config file:
- user-containers.spotizerr
USER=spotizerr DESCRIPTION="Spotify donwloader"
Add the service to the default runlevel and start it now:
/etc/init.d/user-containers.spotizerr start rc-update user-containers.spotizerr