diff --git a/containers/spotdl/Containerfile b/containers/spotdl/Containerfile new file mode 100644 index 0000000..5ef2fec --- /dev/null +++ b/containers/spotdl/Containerfile @@ -0,0 +1,32 @@ +### SpotDL - Spotify Downloader with Web UI +### Based on spotdl: https://github.com/spotDL/spotify-downloader +### +### BUILD: podman build -t localhost/spotdl:latest . +### EXPORT: podman save -o /home/duckpage/Source/bds/bdi_podman_serverconf/containers/spotdl/spotdl.tar localhost/spotdl:latest +### +FROM debian:13-slim + +# Installazione dipendenze di sistema +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + python3 \ + python3-pip \ + ffmpeg \ + aria2 \ + git \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Installazione spotDL +RUN pip3 install --no-cache-dir --break-system-packages spotdl + +# Creazione directory configurazione e download +RUN mkdir -p /app/.config/spotdl /app/downloads + +WORKDIR /app + +# Volume mount point per i download +VOLUME ["/app/downloads"] + +# Comando di default: avvia la web UI +CMD ["spotdl", "web", "--host", "0.0.0.0", "--port", "8800", "--keep-alive", "--keep-sessions"] \ No newline at end of file diff --git a/containers/spotdl/config.json.template b/containers/spotdl/config.json.template new file mode 100644 index 0000000..afcb277 --- /dev/null +++ b/containers/spotdl/config.json.template @@ -0,0 +1,76 @@ +{ + "client_id": "5f573c9620494bae87890c0f08a60293", + "client_secret": "212476d9b0f3472eaa762d90b19b0ba8", + "auth_token": null, + "user_auth": true, + "headless": false, + "cache_path": "/app/.config/spotdl/.spotipy", + "no_cache": false, + "max_retries": 3, + "use_cache_file": false, + "use_official_api": false, + "audio_providers": [ + "youtube-music" + ], + "lyrics_providers": [ + "genius", + "azlyrics", + "musixmatch" + ], + "genius_token": "alXXDbPZtK1m2RrZ8I4k2Hn8Ahsd0Gh_o076HYvcdlBvmc0ULL1H8Z8xRlew5qaG", + "playlist_numbering": false, + "playlist_retain_track_cover": false, + "scan_for_songs": false, + "m3u": null, + "output": "{artists} - {title}.{output-ext}", + "overwrite": "skip", + "search_query": null, + "ffmpeg": "ffmpeg", + "bitrate": "128k", + "ffmpeg_args": null, + "format": "mp3", + "save_file": null, + "filter_results": true, + "album_type": null, + "threads": 4, + "cookie_file": null, + "restrict": null, + "print_errors": false, + "sponsor_block": false, + "preload": false, + "archive": null, + "load_config": true, + "log_level": "INFO", + "simple_tui": false, + "fetch_albums": false, + "id3_separator": "/", + "ytm_data": false, + "add_unavailable": false, + "generate_lrc": false, + "force_update_metadata": false, + "only_verified_results": false, + "sync_without_deleting": false, + "max_filename_length": null, + "yt_dlp_args": null, + "detect_formats": null, + "save_errors": null, + "ignore_albums": null, + "proxy": null, + "skip_explicit": false, + "log_format": null, + "redownload": false, + "skip_album_art": false, + "create_skip_file": false, + "respect_skip_file": false, + "sync_remove_lrc": false, + "web_use_output_dir": false, + "port": 8800, + "host": "localhost", + "keep_alive": true, + "enable_tls": false, + "key_file": null, + "cert_file": null, + "ca_file": null, + "allowed_origins": null, + "keep_sessions": true +} diff --git a/containers/spotdl/spotdl.README b/containers/spotdl/spotdl.README new file mode 100644 index 0000000..28d219a --- /dev/null +++ b/containers/spotdl/spotdl.README @@ -0,0 +1,118 @@ +# SpotDL - Spotify Downloader + +Scarica playlist, album e brani di Spotify con metadata, copertine e testi. + +## Build Container + +```bash +cd /home/duckpage/Source/bds/bdi_podman_serverconf/containers/spotdl +podman build -t localhost/spotdl:latest . +``` + +## Setup Iniziale + +### 1. Creare le directory + +```bash +mkdir -p /srv/containers/spotdl/downloads +``` + +### 2. Configurazione + +Copiare il template e personalizzarlo: + +```bash +cp /home/duckpage/Source/bds/bdi_podman_serverconf/containers/spotdl/config.json.template \ + /srv/containers/spotdl/config.json +``` + +Modificare `/srv/containers/spotdl/config.json` con le proprie impostazioni: +- `client_id` / `client_secret` — credenziali Spotify (quelle di default funzionano, ma per uso intensivo crearne di proprie su [Spotify Developer](https://developer.spnanotify.com/dashboard)) +- `output` — formato del nome file (default: `{artists} - {title}.{output-ext}`) +- `format` — formato audio (mp3, flac, opus, m4a, ecc.) +- `bitrate` — bitrate di uscita (default: 128k) +- `audio_providers` — sorgenti audio (default: youtube-music) + +### 3. Copiare il file quadlet + +```bash + ~/.config/containers/systemd/ +``` + +### 4. Avviare il container + +```bash +systemctl --user daemon-reload +systemctl --user start spotdl +systemctl --user enable spotdl +``` + +## Utilizzo + +### Scaricare una playlist + +```bash +podman exec spotdl spotdl download "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M" +``` + +### Scaricare un album + +```bash +podman exec spotdl spotdl download "https://open.spotify.com/album/1DFixwWVzKdAJ0i3gGdK2R" +``` + +### Scaricare brani per nome + +```bash +podman exec spotdl spotdl download "Daft Punk - One More Time" +``` + +### Ottenere solo i link (URL download) + +```bash +podman exec spotdl spotdl url "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M" +``` + +### Sincronizzare la cartella di download + +```bash +podman exec spotdl spotdl sync /srv/containers/spotdl/downloads/playlist.spotdl +``` + +### Avviare l'interfaccia web + +```bash +podman exec spotdl spotdl web +``` + +## Comandi utili + +```bash +# Controllare lo stato +podman ps | grep spotdl + +# Vedere i log +podman logs spotdl + +# Aggiornare l'immagine +podman build -t localhost/spotdl:latest . +systemctl --user restart spotdl + +# Rimuovere il container +systemctl --user stop spotdl +podman rm spotdl +``` + +## Struttura volumi + +| Host | Container | Note | +|------|-----------|------| +| `/srv/containers/spotdl/config.json` | `/app/.config/spotdl/config.json` | Config (sola lettura) | +| `/srv/containers/spotdl/downloads/` | `/app/downloads/` | Brani scaricati | + +## Note + +- I brani vengono cercati su YouTube/YouTube Music e scaricati con ffmpeg +- Il formato predefinito è MP3 a 128kbps +- Per audio di qualità superiore, impostare `format: "flac"` e `bitrate: "disable"` nella config +- Serve connessione internet per cercare e scaricare i brani diff --git a/containers/spotdl/spotdl.container b/containers/spotdl/spotdl.container new file mode 100644 index 0000000..c51e663 --- /dev/null +++ b/containers/spotdl/spotdl.container @@ -0,0 +1,27 @@ +[Unit] +Name=spotdl +After=network-online.target +Wants=network-online.target + +[Container] +ContainerName=spotdl +Image=localhost/spotdl:latest +Network=internal.network +PodmanArgs=--rm=false + +# Web UI +PublishPort=8800:8800 +# OAuth callback (per autenticazione utente) +PublishPort=9900:9900 + +# Configurazione spotDL +Volume=/srv/containers/spotdl/config.json:/app/.config/spotdl/config.json:ro +Volume=/srv/containers/spotdl/downloads:/app/downloads +Volume=/srv/containers/spotdl/.spotipy:/app/.config/spotdl/.spotipy + +[Service] +Restart=on-failure +TimeoutStartSec=5m + +[Install] +WantedBy=multi-user.target default.target \ No newline at end of file