2020-08-15 22:22:39 -04:00
# Set Up Guide
## Spotify
* Create a [Spotify Application ](https://developer.spotify.com/dashboard/applications )
2020-08-23 13:08:24 -04:00
* Take note of:
2020-08-15 22:22:39 -04:00
* `Client ID`
* `Client Secret`
* Click on **Edit Settings **
* In **Redirect URIs ** :
* Add `http://localhost/callback/`
## Refresh Token
* Navigate to the following URL:
```
https://accounts.spotify.com/authorize?client_id={SPOTIFY_CLIENT_ID}&response_type=code&scope=user-read-currently-playing,user-read-recently-played&redirect_uri=http://localhost/callback/
```
* After logging in, save the {CODE} portion of: `http://localhost/callback/?code={CODE}`
2020-08-23 11:52:23 -04:00
* Create a string combining `{SPOTIFY_CLIENT_ID}:{SPOTIFY_CLIENT_SECRET}` (e.g. `5n7o4v5a3t7o5r2e3m1:5a8n7d3r4e2w5n8o2v3a7c5` ) and **encode ** into [Base64 ](https://base64.io/ ).
2020-08-15 22:22:39 -04:00
* Then run a [curl command ](https://httpie.org/run ) in the form of:
```sh
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic {BASE64}" -d "grant_type=authorization_code&redirect_uri=http://localhost/callback/&code={CODE}" https://accounts.spotify.com/api/token
```
* Save the Refresh token
## Vercel
* Register on [Vercel ](https://vercel.com/ )
* Create project linked to your github repo
2020-08-23 11:52:23 -04:00
* Add Environment Variables:
2020-08-15 22:22:39 -04:00
* `https://vercel.com/<YourName>/<ProjectName>/settings/environment-variables`
* `SPOTIFY_REFRESH_TOKEN`
* `SPOTIFY_CLIENT_ID`
* `SPOTIFY_SECRET_ID`
* Deploy!
2020-08-23 10:34:18 -04:00
## ReadMe
You can now use the following in your readme:
2020-08-23 11:32:27 -04:00
```[](https://open.spotify.com/user/USER_NAME)` ``
## Customization
2020-08-25 19:36:17 -04:00
If you want a distinction between the widget showing your currently playing, and your recently playing:
2020-08-23 11:32:27 -04:00
2020-08-25 19:36:17 -04:00
### Hide the EQ bar
Remove the `#` in front of `contentBar` in [line 81 ](https://github.com/novatorem/novatorem/blob/98ba4a8489ad86f5f73e95088e620e8859d28e71/api/spotify.py#L81 ) of current master, then the EQ bar will be hidden when you're in not currently playing anything.
### Status String
Have a string saying either "Vibing to:" or "Last seen playing:".
* Change [`height` to `height + 40` ](https://github.com/novatorem/novatorem/blob/5194a689253ee4c89a9d365260d6050923d93dd5/api/templates/spotify.html.j2#L1-L2 ) (or whatever `margin-top` is set to)
* Uncomment [**.main**'s `margin-top` ](https://github.com/novatorem/novatorem/blob/5194a689253ee4c89a9d365260d6050923d93dd5/api/templates/spotify.html.j2#L10 )
* Uncomment [currentStatus ](https://github.com/novatorem/novatorem/blob/5194a689253ee4c89a9d365260d6050923d93dd5/api/templates/spotify.html.j2#L93 )
## Requests
Customization requests can be submitted as an issue, like https://github.com/novatorem/novatorem/issues/2
2020-08-31 07:52:29 -04:00
If you want to share your own customization options, open a PR if it's done or open an issue if you want it implemented by someone else.
## Debugging
If you have issues setting up, try following this [guide ](https://youtu.be/n6d4KHSKqGk?t=615 ).
Followed the guide and still having problems?
Try checking out the functions tab in vercel, linked as:
```https://vercel.com/{name}/spotify/{build}/functions` ``
<details><summary>Which looks like-</summary>

</details><br>
You will see a log there, and most issues can be resolved by ensuring you have the correct variables from setup.