Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 4f8a33f

Browse files
authored
Merge pull request #39 from codeoverflow-org/feature/spotify-sample
Add doc for spotify sample
2 parents 8e3a800 + 7d47087 commit 4f8a33f

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

docs/samples/spotify.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## Using the Spotify sample bundle
2+
3+
The spotify-current-song example bundle in `samples/spotify-current-song` demonstrates the ability to get the current playing song of a user. Here is a guide to how to get it working.
4+
5+
### Prerequisites
6+
7+
- Working NodeCG & nodecg-io installation
8+
- A Spotify account and a registered Spotify application and the accosiated client id/client secret.
9+
10+
_Note:_ If you don't have a registered application yet you can follow [this guide](https://developer.spotify.com/documentation/general/guides/app-settings/#register-your-app). As a redirect url use [http://localhost:9090/nodecg-io-spotify/spotifycallback](http://localhost:9090/nodecg-io-spotify/spotifycallback).
11+
12+
### Configure the Spotify sample bundle
13+
14+
1. Start nodecg with nodecg-io installed. The spotify-current-song bundle is currently part of it so it should also be loaded.
15+
16+
2. Go to the `nodecg-io` tab in the nodecg dashboard.
17+
18+
3. Login using your password. If this is your first run, then enter the password with which you want to encrypt your configurations and credentials.
19+
20+
4. Create a new spotify service instance using the left upper menu.
21+
22+
5. Enter credentials for spotify.
23+
24+
The created instance should be automatically selected, if not select it in the upper left menu. Enter your client id and secret in monaco (the texteditor on the right) in this format:
25+
26+
```json
27+
{
28+
"scopes": [
29+
"user-read-playback-state"
30+
],
31+
"clientId": "0123456789abcdef0123456789abcdef",
32+
"clientSecret": "0123456789abcdef0123456789abcdef"
33+
}
34+
```
35+
36+
After entering it, click save.
37+
38+
_Note:_ If you don't see monaco on the right, try reloading the page.
39+
_Note:_ This sample requires the `user-read-playback-state` scope, but you can require other scopes if you want to use functions that require them.
40+
A list of all scopes can be found [here](https://developer.spotify.com/documentation/general/guides/scopes/).
41+
42+
6. Set the created spotify service instance to the service dependency of the spotify-current-song bundle.
43+
44+
Select the spotify-current-song bundle and the spotify service in the left bottom menu and then select the service instance that should be used by the spotify-current-song bundle (in this case the name of the previously created spotify instance).
45+
46+
7. Check the nodecg logs
47+
48+
You should see an error or a success message and the current playing song with name and artists.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ nav:
6161
- sACN Sender sample: samples/sacn-sender.md
6262
- Serial sample: samples/serial.md
6363
- Slack sample: samples/slack.md
64+
- Spotify sample: samples/spotify.md
6465
- Streamdeck sample: samples/streamdeck.md
6566
- Telegram sample: samples/telegram.md
6667
- TIANE sample: samples/tiane.md

0 commit comments

Comments
 (0)