Skip to content

Latest commit

 

History

History
96 lines (74 loc) · 3.41 KB

README.md

File metadata and controls

96 lines (74 loc) · 3.41 KB

spotifybackup

This Docker image allows you to automate a full backup of your Spotify Library every day using Spotishell PS module.
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 Dashboard and create an app:

  • App name : spotifybackup
  • App description : spotifybackup
  • Redirect URI : http://localhost:8080/spotishell

step1.1.png step1.2.png
Step2: Collect Client ID and Secret
step2.1.png step2.2.png

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:
setup1.png
Paste authorization URL in your browser, read then accept:
setup2.png
Copy the redirected url from the address bar:
setup3.png
Paste it into the setup container window (you should then receive a green result):
setup4.png

Resulting connection information are then stored into the spotifybackup docker volume

Run spotifybackup

Docker Quick-Run

docker run \
    -d \
    --name spotifybackup \
    -e BACKUPHOUR=2 \
    -e BACKUPRETENTION=30 \
    -e BACKUPPREFIX=SpotifyBackup \
    -v spotifybackup:/data \
    domochip/spotifybackup

Docker-Compose Quick-Run

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:
run1.png

Check container log:
run2.png

🎉 Then 3 days later 🎉:
run3.png

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:

Import-Module Spotishell
Restore-Library -Path '/data/SpotifyBackup-2023-05-11-01-00.json'
Exit