Skip to content

Repository files navigation

Daily Shuffle

Create shuffled versions of your Spotify playlists, refreshed every day

How to Use

  • Open the WebUI and you will be immediately redirected a Spotify authorization prompt
    • This is used to give Daily Shuffle access to your spotify playlists, as well as to authenticate you with the WebUI so there's no need for a password.
  • Once you are logged in, you can create a job with the Add a New Job panel
    • First, if the list of sources is empty press Search to load your playlists, then select one from the dropdown
    • You can change the name of the playlist if you like, or change it later in the Spotify app
    • Press Save and you'r new playlist will be created and shuffled for the first time!
    • Now every day all the songs in the source playlist will be copied to the destination in a random order, so if you add or remove songs from the source playlist that will be reflected after the next shuffle
  • Once you have a job saved, you can edit or remove it with the Edit Jobs panel
    • Select a job by it's destination playlist
    • To change the source playlist click Search to load your playlists, pick a new one from the dropdown, then click Save
    • To remove the job click Remove Job
      • This will just stop the shuffle job, the destination playlist will remain with it's content (you can remove it from the Spotify app)

How to Run

If you want the WebUI to be accessible from anything other than localhost you will need to access it through an https reverse proxy like Nginx with Let's Encrypt

  • Create an app in the Spotify Developer Portal
  • Check Web API under Which API/SDKs are you planning to use?
  • Make sure to add the url of your callback endpoint to the Redirect URIs (this should be the same as DAILYSHUFFLE_REDIRECT_URL, and end in /callback)

Docker (Preferred)

  • Download compose.yaml
  • Create an appdata folder
  • Update the environment variables and appdata path in compose.yaml
  • Run docker compose up

Standalone

  • Create a .env file in the directory you will run Daily Shuffle from, using the following template and the client ID and secret from the Spotify Developer Portal
# Required
DAILYSHUFFLE_CLIENT_ID=changeme
DAILYSHUFFLE_CLIENT_SECRET=changeme

# Optional (these are the defaults)
DAILYSHUFFLE_HOSTNAME=127.0.0.1
DAILYSHUFFLE_PORT=8080
DAILYSHUFFLE_REDIRECT_URL=http://127.0.0.1:8080/callback
DAILYSHUFFLE_DB_PATH=dailyShuffle.sqlite # Relative to cwd when running

Contributing

This project is written using the Bun runtime, it will not work with another runtime like NodeJS.

Running

Create a .env file as described in How to Run

bun i -d # Install dev dependencies, or:
bun i -p # Install production dependencies

bun dev # Start the dev server

File Layout

In the src directory:

  • main.ts - The entry point, runs the WebUI server and schedules jobs. Calls helpers from /lib/shuffler.ts
  • lib/
    • types.ts - TypeScript object type definitions
    • shuffler.ts - Wrappers around methods in other files, to give a consistent api to /main.ts
    • api.ts - Interacts with the Spotify API for everything but authentication
    • auth.ts - Handles authentication with the Spotify API
    • db.ts - Stores and interacts with persistent data like users and jobs
  • ui/
    • index.html - Single page interface, using the Bulma CSS framework
    • main.ts - Transpiled to js by /main.ts

Building for Release

All you have to do it run bun release and all the weird stuff is handled. What it does is:

  • Compile src/ui/main.ts to build/ui.js
  • Set DAILYSHUFFLE_BUNDLED=true so the bundle knows it's a bundle and should use the bundled ui.js
  • Compile everything into 5 different architecture binaries in dist/
  • Fix the interpreter path in the elf header of the linux binaries (only needed when building on NixOS)

License

Create shuffled versions of your playlists, refreshed every day
Copyright (C) 2025  Alice Jacka

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

About

Create shuffled versions of your Spotify playlists, refreshed every day

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages