morningalarm/README.md
2023-08-26 23:54:17 +02:00

1.4 KiB

Morning alarm

A simple alarm clock that plays a random song from a playlist at a given time on you Spotify device of choice. Basicly a cronjob for Spotify.

Setup

  1. Create a new Spotify app at https://developer.spotify.com/dashboard
  2. Give it a name and description
  3. The redirect URI should be a valid URL as it will be used as a callback. (Only needs to accsessable from your local machine). The redirect URI should be the same as in the config.
  4. Copy the client ID and client secret and paste them in the config.
  5. Set the device ID to the device you want to play the music on. You can keep this empty if you don't know the device ID. You can retrieve it later via the API. (GET /api/device)
  6. Get the playlist ID of the playlist you want to play. You can get the playlist ID by right clicking on the playlist in the Spotify app and selecting "Share" and then "Copy link to playlist". Then grab the id from the URL (The part behind /playlist/<id> ) . e.g. 0MJBni0UzdnML1amikx0Rc. Paste the playlist ID in the config.
  7. Set the redirect URI in the config.
  8. Start the app and look in the console for the URL to authorize the app. Open the URL in your browser and authorize the app.
  9. If you have not already set the device ID, you can do so now. (GET /api/device). Don't forget to restart with the new device ID.
  10. Test the app by calling the API (POST /api/trigger). This should play a random song from the playlist on the device you selected.