Closed smadigan91 closed 4 years ago
sample request json for easy access
{
"playlist_name": "playlist name",
"seed": {
"playlist": "http://spotify.com/playlist/uri/or/id/or/url",
"tracks": [
"uri1/id1/link1",
"uri2/id2/link2"
],
"artists": [
"uri1/id1/link1",
"uri2/id2/link2"
],
"genres": [
"genre1"
]
},
"parameters": {
"target": {
"track_attributes": {
"duration_ms": 255349,
"key": 5,
"mode": 0,
"time_signature": 4,
"acousticness": 0.514,
"danceability": 0.735,
"energy": 0.578,
"instrumentalness": 0.0902,
"liveness": 0.159,
"speechiness": 0.0461,
"valence": 0.624,
"tempo": 98.002,
"popularity": 55
}
},
"min": {
"track_attributes": {
"duration_ms": 255349,
"key": 5,
"mode": 0,
"time_signature": 4,
"acousticness": 0.514,
"danceability": 0.735,
"energy": 0.578,
"instrumentalness": 0.0902,
"liveness": 0.159,
"speechiness": 0.0461,
"valence": 0.624,
"tempo": 98.002,
"popularity": 55
}
},
"max": {
"track_attributes": {
"duration_ms": 255349,
"key": 5,
"mode": 0,
"time_signature": 4,
"acousticness": 0.514,
"danceability": 0.735,
"energy": 0.578,
"instrumentalness": 0.0902,
"liveness": 0.159,
"speechiness": 0.0461,
"valence": 0.624,
"tempo": 98.002,
"popularity": 55
}
}
}
}
Note:
having a playlist available as a seed, isn't something spotify directly supports, but I want to support it. The idea is that given a playlist, for every song in that playlist, collect recommendations based on the provided parameters, then throw all those recommendations on the generated playlist. This is really helpful for generating similar playlists as well as hundreds upon hundreds of recommendations at once
there can only be 5 total of the combination of seed_artists, seed_genres, and seed_tracks, and if a playlist url is given for the seed the backend will use that instead regardless of the presence of other seeds.
if there are any target_*
attributes specified, those attributes will be ignored if they appear inmin_*
or max_*
. Spotify's API will only accept target_*
OR min_*
and/or max_*
for a specific attribute
maybe the frontend could do validation around the values entered for the parameters? Per the spotify docs, they only allow certain ranges for each attribute. The backend could also do this if we wanted, idc
the playlist_name is the name of the playlist that will be generated in the user's account, it can be optional, we can just throw some generated name in there if they don't supply one
Given a Recommendation Specification object, generate a playlist with the songs that were recommended.
Should be able to take any form of identification for seed information, e.g. a url, uri, or id. The backend can worry about sanitizing the input.