https://github.com/domochip/spotifybackup
Automate a full backup of your Spotify Library every day
https://github.com/domochip/spotifybackup
backup docker spotify
Last synced: 9 months ago
JSON representation
Automate a full backup of your Spotify Library every day
- Host: GitHub
- URL: https://github.com/domochip/spotifybackup
- Owner: Domochip
- Created: 2021-10-24T11:07:35.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-02T11:43:51.000Z (almost 2 years ago)
- Last Synced: 2025-02-01T20:04:02.854Z (over 1 year ago)
- Topics: backup, docker, spotify
- Language: PowerShell
- Homepage:
- Size: 896 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spotifybackup
This Docker image allows you to automate a full backup of your Spotify Library every day using [Spotishell PS module](https://github.com/wardbox/spotishell).
This full backup can be used to be restored over your account or another one.
# Prerequisites
You first need to create a Spotify Application.
**Step1**: Go to the [Spotify for Developers](https://developer.spotify.com/dashboard) Dashboard and create an app:
- App name : `spotifybackup`
- App description : `spotifybackup`
- Redirect URI : `http://127.0.0.1:8080/spotishell`
 
**Step2**: Collect Client ID and Secret
 
# Setup connection to Spotify
To setup Spotify connection, you need to run the image in "setup mode" using this commandline and follow instruction:
`docker run -it --rm -v spotifybackup:/data --entrypoint pwsh domochip/spotifybackup setup.ps1`
### E.g:
Provide Client ID and Client Secret then copy authorization URL:

Paste authorization URL in your browser, read then accept:

Copy the redirected url from the address bar:

Paste it into the setup container window (you should then receive a green result):

**Resulting connection information are then stored into the `spotifybackup` docker volume**
# Run spotifybackup
Docker Quick-Run
```bash
docker run \
-d \
--name spotifybackup \
-e BACKUPHOUR=2 \
-e BACKUPRETENTION=30 \
-e BACKUPPREFIX=SpotifyBackup \
-v spotifybackup:/data \
domochip/spotifybackup
```
Docker-Compose Quick-Run
```yaml
version: '3'
volumes:
spotifybackup:
services:
spotifybackup:
container_name: spotifybackup
image: domochip/spotifybackup
volumes:
- spotifybackup:/data
environment:
- BACKUPHOUR=2
- BACKUPRETENTION=30
- BACKUPPREFIX=SpotifyBackup
```
(Backup your library everyday at 2:00PM)
#### Environment variables
* `BACKUPHOUR`: **Optional**, (Integer: 0 to 23) hour of publish everyday
* `BACKUPRETENTION`: **Optional**, (Positive Integer) Number of backup files to retain. Older files over this number are deleted
* `BACKUPPREFIX`: **Optional**, (String) First part of the backup file names
### E.g.
Container creation:

Check container log:

🎉 Then 3 days later 🎉:

# Restore a backup
To restore your Spotify Library, you need to run the image in interactive mode (using your volume):
`docker run -it --rm -v spotifybackup:/data --entrypoint pwsh domochip/spotifybackup`
Then use these commands:
```powershell
Import-Module Spotishell
Restore-Library -Path '/data/SpotifyBackup-2023-05-11-01-00.json'
Exit
```